diff --git a/app/global.d.ts b/app/global.d.ts index 6061bbfa..0e003110 100644 --- a/app/global.d.ts +++ b/app/global.d.ts @@ -7,5 +7,8 @@ declare global { getMissionList?: typeof getMissionList; getMissionInfo?: typeof getMissionInfo; loadDemoRecording?: (recording: DemoRecording) => void; + getDemoDiagnostics?: () => unknown; + getDemoDiagnosticsJson?: () => string; + clearDemoDiagnostics?: () => void; } } diff --git a/app/page.tsx b/app/page.tsx index 2c2fab4c..e934c76f 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -29,10 +29,25 @@ import { ObserverCamera } from "@/src/components/ObserverCamera"; import { AudioProvider } from "@/src/components/AudioContext"; import { DebugElements } from "@/src/components/DebugElements"; import { CamerasProvider } from "@/src/components/CamerasProvider"; -import { DemoProvider, useDemo } from "@/src/components/DemoProvider"; +import { + DemoProvider, + useDemoActions, + useDemoIsPlaying, + useDemoRecording, +} from "@/src/components/DemoProvider"; import { DemoPlayback } from "@/src/components/DemoPlayback"; import { DemoControls } from "@/src/components/DemoControls"; -import { getMissionList, getMissionInfo } from "@/src/manifest"; +import { PlayerHUD } from "@/src/components/PlayerHUD"; +import { + buildSerializableDiagnosticsJson, + buildSerializableDiagnosticsSnapshot, + useEngineStoreApi, +} from "@/src/state"; +import { + getMissionList, + getMissionInfo, + findMissionByDemoName, +} from "@/src/manifest"; import { createParser, parseAsBoolean, useQueryState } from "nuqs"; const MapInfoDialog = lazy(() => @@ -53,6 +68,17 @@ const glSettings: GLProps = { outputColorSpace: SRGBColorSpace, }; +function summarizeCallStack(skipFrames = 0): string | null { + const stack = new Error().stack; + if (!stack) return null; + const lines = stack + .split("\n") + .map((line) => line.trim()) + .filter(Boolean); + const callsiteLines = lines.slice(1 + skipFrames, 9 + skipFrames); + return callsiteLines.length > 0 ? callsiteLines.join(" <= ") : null; +} + type CurrentMission = { missionName: string; missionType?: string; @@ -90,6 +116,7 @@ function MapInspector() { "mission", parseAsMissionWithType, ); + const engineStore = useEngineStoreApi(); const [fogEnabledOverride, setFogEnabledOverride] = useQueryState( "fog", parseAsBoolean, @@ -99,13 +126,34 @@ function MapInspector() { setFogEnabledOverride(null); }, [setFogEnabledOverride]); + const currentMissionRef = useRef(currentMission); + currentMissionRef.current = currentMission; + const changeMission = useCallback( (mission: CurrentMission) => { + const previousMission = currentMissionRef.current; + const stack = summarizeCallStack(1); + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "mission.change.requested", + message: "changeMission invoked", + meta: { + previousMissionName: previousMission.missionName, + previousMissionType: previousMission.missionType ?? null, + nextMissionName: mission.missionName, + nextMissionType: mission.missionType ?? null, + stack: stack ?? "unavailable", + }, + }); + console.info("[mission trace] changeMission", { + previousMission, + nextMission: mission, + stack, + }); window.location.hash = ""; clearFogEnabledOverride(); setCurrentMission(mission); }, - [setCurrentMission, clearFogEnabledOverride], + [engineStore, setCurrentMission, clearFogEnabledOverride], ); const isTouch = useTouchDevice(); @@ -228,6 +276,7 @@ function MapInspector() { + {isTouch && ( )} + @@ -265,6 +315,64 @@ function MapInspector() { ); } +/** Map from Tribes 2 game type display names to manifest mission type codes. */ +const GAME_TYPE_TO_MISSION_TYPE: Record = { + "Capture the Flag": "CTF", + "Capture and Hold": "CnH", + Deathmatch: "DM", + "Team Deathmatch": "TDM", + Siege: "Siege", + Bounty: "Bounty", + Rabbit: "Rabbit", +}; + +/** + * When a demo recording is loaded, switch to the mission it was recorded on. + */ +function DemoMissionSync({ + changeMission, + currentMission, +}: { + changeMission: (mission: CurrentMission) => void; + currentMission: CurrentMission; +}) { + const recording = useDemoRecording(); + + useEffect(() => { + if (!recording?.missionName) return; + + const missionName = findMissionByDemoName(recording.missionName); + if (!missionName) { + console.warn( + `Demo mission "${recording.missionName}" not found in manifest`, + ); + return; + } + + const info = getMissionInfo(missionName); + const missionTypeCode = recording.gameType + ? GAME_TYPE_TO_MISSION_TYPE[recording.gameType] + : undefined; + const missionType = + missionTypeCode && info.missionTypes.includes(missionTypeCode) + ? missionTypeCode + : info.missionTypes[0]; + + // Skip if we're already on the correct mission to avoid unnecessary + // remount cascades (e.g. after a Suspense boundary restores). + if ( + currentMission.missionName === missionName && + currentMission.missionType === missionType + ) { + return; + } + + changeMission({ missionName, missionType }); + }, [recording, changeMission, currentMission]); + + return null; +} + /** * Disables observer/touch controls when a demo is playing so they don't * fight the animated camera. @@ -282,7 +390,7 @@ function DemoAwareControls({ lookJoystickStateRef: React.RefObject; lookJoystickZoneRef: React.RefObject; }) { - const { isPlaying } = useDemo(); + const isPlaying = useDemoIsPlaying(); if (isPlaying) return null; if (isTouch === null) return null; if (isTouch) { @@ -300,14 +408,27 @@ function DemoAwareControls({ /** Exposes `window.loadDemoRecording` for automation/testing. */ function DemoWindowAPI() { - const { setRecording } = useDemo(); + const { setRecording } = useDemoActions(); + const engineStore = useEngineStoreApi(); useEffect(() => { window.loadDemoRecording = setRecording; + window.getDemoDiagnostics = () => { + return buildSerializableDiagnosticsSnapshot(engineStore.getState()); + }; + window.getDemoDiagnosticsJson = () => { + return buildSerializableDiagnosticsJson(engineStore.getState()); + }; + window.clearDemoDiagnostics = () => { + engineStore.getState().clearPlaybackDiagnostics(); + }; return () => { delete window.loadDemoRecording; + delete window.getDemoDiagnostics; + delete window.getDemoDiagnosticsJson; + delete window.clearDemoDiagnostics; }; - }, [setRecording]); + }, [engineStore, setRecording]); return null; } diff --git a/app/style.css b/app/style.css index aae48cc7..03b447d1 100644 --- a/app/style.css +++ b/app/style.css @@ -246,6 +246,32 @@ input[type="range"] { text-align: center; } +.PlayerNameplate { + pointer-events: none; + text-align: center; + white-space: nowrap; +} + +.PlayerNameplate-name { + color: #fff; + font-size: 11px; + text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 1px rgba(0, 0, 0, 0.7); +} + +.PlayerNameplate-healthBar { + width: 60px; + height: 4px; + background: rgba(0, 0, 0, 0.5); + border: 1px solid rgba(255, 255, 255, 0.2); + margin: 2px auto 0; + overflow: hidden; +} + +.PlayerNameplate-healthFill { + height: 100%; + background: #2ecc40; +} + .StatsPanel { left: auto !important; top: auto !important; @@ -621,3 +647,119 @@ input[type="range"] { inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 2px rgba(0, 0, 0, 0.3) !important; } + +.DemoControls { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + align-items: center; + gap: 10px; + padding: 8px 12px; + background: rgba(0, 0, 0, 0.7); + color: #fff; + font-size: 13px; + z-index: 2; +} + +.DemoControls-playPause { + width: 32px; + height: 32px; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; + padding: 0; + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 4px; + background: rgba(3, 82, 147, 0.6); + color: #fff; + font-size: 14px; + cursor: pointer; +} + +@media (hover: hover) { + .DemoControls-playPause:hover { + background: rgba(0, 98, 179, 0.8); + } +} + +.DemoControls-time { + flex-shrink: 0; + font-variant-numeric: tabular-nums; + white-space: nowrap; +} + +.DemoControls-seek[type="range"] { + flex: 1 1 0; + min-width: 0; + max-width: none; +} + +.DemoControls-speed { + flex-shrink: 0; + padding: 2px 4px; + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 3px; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 12px; +} + +.DemoDiagnosticsPanel { + display: flex; + flex-direction: column; + gap: 3px; + margin-left: 8px; + padding: 4px 8px; + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 4px; + background: rgba(0, 0, 0, 0.55); + min-width: 320px; +} + +.DemoDiagnosticsPanel[data-context-lost="true"] { + border-color: rgba(255, 90, 90, 0.8); + background: rgba(70, 0, 0, 0.45); +} + +.DemoDiagnosticsPanel-status { + font-size: 11px; + font-weight: 700; + letter-spacing: 0.02em; +} + +.DemoDiagnosticsPanel-metrics { + display: flex; + flex-wrap: wrap; + gap: 4px 10px; + font-size: 11px; + opacity: 0.92; +} + +.DemoDiagnosticsPanel-footer { + display: flex; + flex-wrap: wrap; + gap: 4px 8px; + align-items: center; + font-size: 11px; +} + +.DemoDiagnosticsPanel-footer button { + border: 1px solid rgba(255, 255, 255, 0.3); + border-radius: 3px; + background: rgba(3, 82, 147, 0.6); + color: #fff; + padding: 1px 6px; + font-size: 11px; + cursor: pointer; +} + +.DemoDiagnosticsPanel-footer button:hover { + background: rgba(0, 98, 179, 0.8); +} + +.DemoIcon { + font-size: 19px; +} diff --git a/docs/404.html b/docs/404.html index 5a4babc0..73149611 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 5a4babc0..73149611 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 b48bed34..8b5204f0 100644 --- a/docs/__next.__PAGE__.txt +++ b/docs/__next.__PAGE__.txt @@ -1,9 +1,10 @@ 1:"$Sreact.fragment" 2:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -3:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] +3:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/12e7daed7311216f.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 6:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] 7:"$Sreact.suspense" -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false} +:HL["/t2-mapper/_next/static/chunks/afff663ba7029ccf.css","style"] +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/afff663ba7029ccf.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","async":true}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/12e7daed7311216f.js","async":true}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.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 549e3096..330e2e17 100644 --- a/docs/__next._full.txt +++ b/docs/__next._full.txt @@ -3,14 +3,15 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/12e7daed7311216f.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] e:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] 10:I[68027,[],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"P":null,"b":"-NrDAGL0vu_8RrgSU0FFY","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/284925ee1f24c201.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +:HL["/t2-mapper/_next/static/chunks/afff663ba7029ccf.css","style"] +0:{"P":null,"b":"TA1NEd7uhnyFsTRk4wMjb","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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/afff663ba7029ccf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/12e7daed7311216f.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.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 bfcb8161..7b377486 100644 --- a/docs/__next._head.txt +++ b/docs/__next._head.txt @@ -3,4 +3,4 @@ 3:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","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":"TA1NEd7uhnyFsTRk4wMjb","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 eca24451..11349f6a 100644 --- a/docs/__next._index.txt +++ b/docs/__next._index.txt @@ -2,5 +2,5 @@ 2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] 3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/284925ee1f24c201.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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 ccabecd6..b252078b 100644 --- a/docs/__next._tree.txt +++ b/docs/__next._tree.txt @@ -1,2 +1,3 @@ -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +:HL["/t2-mapper/_next/static/chunks/afff663ba7029ccf.css","style"] +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","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/-NrDAGL0vu_8RrgSU0FFY/_buildManifest.js b/docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_buildManifest.js similarity index 100% rename from docs/_next/static/-NrDAGL0vu_8RrgSU0FFY/_buildManifest.js rename to docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_buildManifest.js diff --git a/docs/_next/static/-NrDAGL0vu_8RrgSU0FFY/_clientMiddlewareManifest.json b/docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_clientMiddlewareManifest.json similarity index 100% rename from docs/_next/static/-NrDAGL0vu_8RrgSU0FFY/_clientMiddlewareManifest.json rename to docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_clientMiddlewareManifest.json diff --git a/docs/_next/static/-NrDAGL0vu_8RrgSU0FFY/_ssgManifest.js b/docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_ssgManifest.js similarity index 100% rename from docs/_next/static/-NrDAGL0vu_8RrgSU0FFY/_ssgManifest.js rename to docs/_next/static/TA1NEd7uhnyFsTRk4wMjb/_ssgManifest.js diff --git a/docs/_next/static/chunks/12e7daed7311216f.js b/docs/_next/static/chunks/12e7daed7311216f.js new file mode 100644 index 00000000..1f5ac409 --- /dev/null +++ b/docs/_next/static/chunks/12e7daed7311216f.js @@ -0,0 +1,528 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38360,(e,t,r)=>{var a={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(a).join("|"),i=RegExp(n,"g"),o=RegExp(n,"");function s(e){return a[e]}var l=function(e){return e.replace(i,s)};t.exports=l,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=l},29402,(e,t,r)=>{var a,n,i,o,s="__lodash_hash_undefined__",l=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",p="[object Map]",g="[object Number]",v="[object Object]",y="[object Promise]",A="[object RegExp]",F="[object Set]",b="[object String]",C="[object Symbol]",B="[object WeakMap]",S="[object ArrayBuffer]",x="[object DataView]",E=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/,D=/^\./,k=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,I=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[u]=R[c]=R[S]=R[d]=R[x]=R[f]=R[h]=R[m]=R[p]=R[g]=R[v]=R[A]=R[F]=R[b]=R[B]=!1;var P=e.g&&e.g.Object===Object&&e.g,G="object"==typeof self&&self&&self.Object===Object&&self,L=P||G||Function("return this")(),j=r&&!r.nodeType&&r,_=j&&t&&!t.nodeType&&t,O=_&&_.exports===j&&P.process,U=function(){try{return O&&O.binding("util")}catch(e){}}(),H=U&&U.isTypedArray;function N(e,t){for(var r=-1,a=e?e.length:0,n=Array(a);++r-1},eC.prototype.set=function(e,t){var r=this.__data__,a=eE(r,e);return a<0?r.push([e,t]):r[a][1]=t,this},eB.prototype.clear=function(){this.__data__={hash:new eb,map:new(el||eC),string:new eb}},eB.prototype.delete=function(e){return eP(this,e).delete(e)},eB.prototype.get=function(e){return eP(this,e).get(e)},eB.prototype.has=function(e){return eP(this,e).has(e)},eB.prototype.set=function(e,t){return eP(this,e).set(e,t),this},eS.prototype.add=eS.prototype.push=function(e){return this.__data__.set(e,s),this},eS.prototype.has=function(e){return this.__data__.has(e)},ex.prototype.clear=function(){this.__data__=new eC},ex.prototype.delete=function(e){return this.__data__.delete(e)},ex.prototype.get=function(e){return this.__data__.get(e)},ex.prototype.has=function(e){return this.__data__.has(e)},ex.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eC){var a=r.__data__;if(!el||a.length<199)return a.push([e,t]),this;r=this.__data__=new eB(a)}return r.set(e,t),this};var eM=(a=function(e,t){return e&&eD(e,t,e0)},function(e,t){if(null==e)return e;if(!eq(e))return a(e,t);for(var r=e.length,n=-1,i=Object(e);++ns))return!1;var u=i.get(e);if(u&&i.get(t))return u==t;var c=-1,d=!0,f=1&n?new eS:void 0;for(i.set(e,t),i.set(t,e);++c-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eX(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function eY(e){return!!e&&"object"==typeof e}function eZ(e){return"symbol"==typeof e||eY(e)&&ee.call(e)==C}var e$=H?J(H):function(e){return eY(e)&&eW(e.length)&&!!R[ee.call(e)]};function e0(e){return eq(e)?function(e,t){var r=ez(e)||eV(e)?function(e,t){for(var r=-1,a=Array(e);++rt||i&&o&&l&&!s&&!u||a&&o&&l||!r&&l||!n)return 1;if(!a&&!i&&!u&&e=s)return l;return l*("desc"==r[a]?-1:1)}}return e.index-t.index}(e,t,r)});l--;)s[l]=s[l].value;return s}(e,t,r))}},76775,(e,t,r)=>{function a(e,t,r,a){return Math.round(e/r)+" "+a+(t>=1.5*r?"s":"")}t.exports=function(e,t){t=t||{};var r,n,i,o,s=typeof e;if("string"===s&&e.length>0){var l=e;if(!((l=String(l)).length>100)){var u=/^(-?(?:\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(u){var c=parseFloat(u[1]);switch((u[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?(n=Math.abs(r=e))>=864e5?a(r,n,864e5,"day"):n>=36e5?a(r,n,36e5,"hour"):n>=6e4?a(r,n,6e4,"minute"):n>=1e3?a(r,n,1e3,"second"):r+" ms":(o=Math.abs(i=e))>=864e5?Math.round(i/864e5)+"d":o>=36e5?Math.round(i/36e5)+"h":o>=6e4?Math.round(i/6e4)+"m":o>=1e3?Math.round(i/1e3)+"s":i+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7003,(e,t,r)=>{t.exports=function(t){function r(e){let t,n,i,o=null;function s(...e){if(!s.enabled)return;let a=Number(new Date);s.diff=a-(t||a),s.prev=t,s.curr=a,t=a,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let n=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,a)=>{if("%%"===t)return"%";n++;let i=r.formatters[a];if("function"==typeof i){let r=e[n];t=i.call(s,r),e.splice(n,1),n--}return t}),r.formatArgs.call(s,e),(s.log||r.log).apply(s,e)}return s.namespace=e,s.useColors=r.useColors(),s.color=r.selectColor(e),s.extend=a,s.destroy=r.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==r.namespaces&&(n=r.namespaces,i=r.enabled(e)),i),set:e=>{o=e}}),"function"==typeof r.init&&r.init(s),s}function a(e,t){let a=r(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function n(e,t){let r=0,a=0,n=-1,i=0;for(;r"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){for(let t of(r.save(e),r.namespaces=e,r.names=[],r.skips=[],("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===t[0]?r.skips.push(t.slice(1)):r.names.push(t)},r.enabled=function(e){for(let t of r.skips)if(n(e,t))return!1;for(let t of r.names)if(n(e,t))return!0;return!1},r.humanize=e.r(76775),r.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=>{r[e]=t[e]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r{let a;var n=e.i(47167);r.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 r="color: "+this.color;e.splice(1,0,r,"color: inherit");let a=0,n=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(a++,"%c"===e&&(n=a))}),e.splice(n,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==n.default&&"env"in n.default&&(e=n.default.env.DEBUG),e},r.useColors=function(){let e;return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),a=!1,r.destroy=()=>{a||(a=!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`."))},r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=e.r(7003)(r);let{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},81405,(e,t,r)=>{var a;e.e,(a=function(){function e(e){return n.appendChild(e.dom),e}function t(e){for(var t=0;to+1e3&&(l.update(1e3*s/(e-o),100),o=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:n,setMode:t}}).Panel=function(e,t,r){var a=1/0,n=0,i=Math.round,o=i(window.devicePixelRatio||1),s=80*o,l=48*o,u=3*o,c=2*o,d=3*o,f=15*o,h=74*o,m=30*o,p=document.createElement("canvas");p.width=s,p.height=l,p.style.cssText="width:80px;height:48px";var g=p.getContext("2d");return g.font="bold "+9*o+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,s,l),g.fillStyle=t,g.fillText(e,u,c),g.fillRect(d,f,h,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d,f,h,m),{dom:p,update:function(l,v){a=Math.min(a,l),n=Math.max(n,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,s,f),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(a)+"-"+i(n)+")",u,c),g.drawImage(p,d+o,f,h-o,m,d,f,h-o,m),g.fillRect(d+h-o,f,o,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d+h-o,f,o,i((1-l/v)*m))}}},t.exports=a},75840,e=>{e.v({Bar:"PlayerHUD-module__-E1Scq__Bar",BarFill:"PlayerHUD-module__-E1Scq__BarFill",ChatWindow:"PlayerHUD-module__-E1Scq__ChatWindow",EnergyBar:"PlayerHUD-module__-E1Scq__EnergyBar PlayerHUD-module__-E1Scq__Bar",HealthBar:"PlayerHUD-module__-E1Scq__HealthBar PlayerHUD-module__-E1Scq__Bar",PlayerHUD:"PlayerHUD-module__-E1Scq__PlayerHUD"})},31713,e=>{"use strict";let t;var r,a,n=e.i(43476),i=e.i(932),o=e.i(71645),s=e.i(91037),l=e.i(8560),u=e.i(90072);e.s(["ACESFilmicToneMapping",()=>u.ACESFilmicToneMapping,"AddEquation",()=>u.AddEquation,"AddOperation",()=>u.AddOperation,"AdditiveAnimationBlendMode",()=>u.AdditiveAnimationBlendMode,"AdditiveBlending",()=>u.AdditiveBlending,"AgXToneMapping",()=>u.AgXToneMapping,"AlphaFormat",()=>u.AlphaFormat,"AlwaysCompare",()=>u.AlwaysCompare,"AlwaysDepth",()=>u.AlwaysDepth,"AlwaysStencilFunc",()=>u.AlwaysStencilFunc,"AmbientLight",()=>u.AmbientLight,"AnimationAction",()=>u.AnimationAction,"AnimationClip",()=>u.AnimationClip,"AnimationLoader",()=>u.AnimationLoader,"AnimationMixer",()=>u.AnimationMixer,"AnimationObjectGroup",()=>u.AnimationObjectGroup,"AnimationUtils",()=>u.AnimationUtils,"ArcCurve",()=>u.ArcCurve,"ArrayCamera",()=>u.ArrayCamera,"ArrowHelper",()=>u.ArrowHelper,"AttachedBindMode",()=>u.AttachedBindMode,"Audio",()=>u.Audio,"AudioAnalyser",()=>u.AudioAnalyser,"AudioContext",()=>u.AudioContext,"AudioListener",()=>u.AudioListener,"AudioLoader",()=>u.AudioLoader,"AxesHelper",()=>u.AxesHelper,"BackSide",()=>u.BackSide,"BasicDepthPacking",()=>u.BasicDepthPacking,"BasicShadowMap",()=>u.BasicShadowMap,"BatchedMesh",()=>u.BatchedMesh,"Bone",()=>u.Bone,"BooleanKeyframeTrack",()=>u.BooleanKeyframeTrack,"Box2",()=>u.Box2,"Box3",()=>u.Box3,"Box3Helper",()=>u.Box3Helper,"BoxGeometry",()=>u.BoxGeometry,"BoxHelper",()=>u.BoxHelper,"BufferAttribute",()=>u.BufferAttribute,"BufferGeometry",()=>u.BufferGeometry,"BufferGeometryLoader",()=>u.BufferGeometryLoader,"ByteType",()=>u.ByteType,"Cache",()=>u.Cache,"Camera",()=>u.Camera,"CameraHelper",()=>u.CameraHelper,"CanvasTexture",()=>u.CanvasTexture,"CapsuleGeometry",()=>u.CapsuleGeometry,"CatmullRomCurve3",()=>u.CatmullRomCurve3,"CineonToneMapping",()=>u.CineonToneMapping,"CircleGeometry",()=>u.CircleGeometry,"ClampToEdgeWrapping",()=>u.ClampToEdgeWrapping,"Clock",()=>u.Clock,"Color",()=>u.Color,"ColorKeyframeTrack",()=>u.ColorKeyframeTrack,"ColorManagement",()=>u.ColorManagement,"CompressedArrayTexture",()=>u.CompressedArrayTexture,"CompressedCubeTexture",()=>u.CompressedCubeTexture,"CompressedTexture",()=>u.CompressedTexture,"CompressedTextureLoader",()=>u.CompressedTextureLoader,"ConeGeometry",()=>u.ConeGeometry,"ConstantAlphaFactor",()=>u.ConstantAlphaFactor,"ConstantColorFactor",()=>u.ConstantColorFactor,"Controls",()=>u.Controls,"CubeCamera",()=>u.CubeCamera,"CubeDepthTexture",()=>u.CubeDepthTexture,"CubeReflectionMapping",()=>u.CubeReflectionMapping,"CubeRefractionMapping",()=>u.CubeRefractionMapping,"CubeTexture",()=>u.CubeTexture,"CubeTextureLoader",()=>u.CubeTextureLoader,"CubeUVReflectionMapping",()=>u.CubeUVReflectionMapping,"CubicBezierCurve",()=>u.CubicBezierCurve,"CubicBezierCurve3",()=>u.CubicBezierCurve3,"CubicInterpolant",()=>u.CubicInterpolant,"CullFaceBack",()=>u.CullFaceBack,"CullFaceFront",()=>u.CullFaceFront,"CullFaceFrontBack",()=>u.CullFaceFrontBack,"CullFaceNone",()=>u.CullFaceNone,"Curve",()=>u.Curve,"CurvePath",()=>u.CurvePath,"CustomBlending",()=>u.CustomBlending,"CustomToneMapping",()=>u.CustomToneMapping,"CylinderGeometry",()=>u.CylinderGeometry,"Cylindrical",()=>u.Cylindrical,"Data3DTexture",()=>u.Data3DTexture,"DataArrayTexture",()=>u.DataArrayTexture,"DataTexture",()=>u.DataTexture,"DataTextureLoader",()=>u.DataTextureLoader,"DataUtils",()=>u.DataUtils,"DecrementStencilOp",()=>u.DecrementStencilOp,"DecrementWrapStencilOp",()=>u.DecrementWrapStencilOp,"DefaultLoadingManager",()=>u.DefaultLoadingManager,"DepthFormat",()=>u.DepthFormat,"DepthStencilFormat",()=>u.DepthStencilFormat,"DepthTexture",()=>u.DepthTexture,"DetachedBindMode",()=>u.DetachedBindMode,"DirectionalLight",()=>u.DirectionalLight,"DirectionalLightHelper",()=>u.DirectionalLightHelper,"DiscreteInterpolant",()=>u.DiscreteInterpolant,"DodecahedronGeometry",()=>u.DodecahedronGeometry,"DoubleSide",()=>u.DoubleSide,"DstAlphaFactor",()=>u.DstAlphaFactor,"DstColorFactor",()=>u.DstColorFactor,"DynamicCopyUsage",()=>u.DynamicCopyUsage,"DynamicDrawUsage",()=>u.DynamicDrawUsage,"DynamicReadUsage",()=>u.DynamicReadUsage,"EdgesGeometry",()=>u.EdgesGeometry,"EllipseCurve",()=>u.EllipseCurve,"EqualCompare",()=>u.EqualCompare,"EqualDepth",()=>u.EqualDepth,"EqualStencilFunc",()=>u.EqualStencilFunc,"EquirectangularReflectionMapping",()=>u.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>u.EquirectangularRefractionMapping,"Euler",()=>u.Euler,"EventDispatcher",()=>u.EventDispatcher,"ExternalTexture",()=>u.ExternalTexture,"ExtrudeGeometry",()=>u.ExtrudeGeometry,"FileLoader",()=>u.FileLoader,"Float16BufferAttribute",()=>u.Float16BufferAttribute,"Float32BufferAttribute",()=>u.Float32BufferAttribute,"FloatType",()=>u.FloatType,"Fog",()=>u.Fog,"FogExp2",()=>u.FogExp2,"FramebufferTexture",()=>u.FramebufferTexture,"FrontSide",()=>u.FrontSide,"Frustum",()=>u.Frustum,"FrustumArray",()=>u.FrustumArray,"GLBufferAttribute",()=>u.GLBufferAttribute,"GLSL1",()=>u.GLSL1,"GLSL3",()=>u.GLSL3,"GreaterCompare",()=>u.GreaterCompare,"GreaterDepth",()=>u.GreaterDepth,"GreaterEqualCompare",()=>u.GreaterEqualCompare,"GreaterEqualDepth",()=>u.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>u.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>u.GreaterStencilFunc,"GridHelper",()=>u.GridHelper,"Group",()=>u.Group,"HalfFloatType",()=>u.HalfFloatType,"HemisphereLight",()=>u.HemisphereLight,"HemisphereLightHelper",()=>u.HemisphereLightHelper,"IcosahedronGeometry",()=>u.IcosahedronGeometry,"ImageBitmapLoader",()=>u.ImageBitmapLoader,"ImageLoader",()=>u.ImageLoader,"ImageUtils",()=>u.ImageUtils,"IncrementStencilOp",()=>u.IncrementStencilOp,"IncrementWrapStencilOp",()=>u.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>u.InstancedBufferAttribute,"InstancedBufferGeometry",()=>u.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>u.InstancedInterleavedBuffer,"InstancedMesh",()=>u.InstancedMesh,"Int16BufferAttribute",()=>u.Int16BufferAttribute,"Int32BufferAttribute",()=>u.Int32BufferAttribute,"Int8BufferAttribute",()=>u.Int8BufferAttribute,"IntType",()=>u.IntType,"InterleavedBuffer",()=>u.InterleavedBuffer,"InterleavedBufferAttribute",()=>u.InterleavedBufferAttribute,"Interpolant",()=>u.Interpolant,"InterpolateDiscrete",()=>u.InterpolateDiscrete,"InterpolateLinear",()=>u.InterpolateLinear,"InterpolateSmooth",()=>u.InterpolateSmooth,"InterpolationSamplingMode",()=>u.InterpolationSamplingMode,"InterpolationSamplingType",()=>u.InterpolationSamplingType,"InvertStencilOp",()=>u.InvertStencilOp,"KeepStencilOp",()=>u.KeepStencilOp,"KeyframeTrack",()=>u.KeyframeTrack,"LOD",()=>u.LOD,"LatheGeometry",()=>u.LatheGeometry,"Layers",()=>u.Layers,"LessCompare",()=>u.LessCompare,"LessDepth",()=>u.LessDepth,"LessEqualCompare",()=>u.LessEqualCompare,"LessEqualDepth",()=>u.LessEqualDepth,"LessEqualStencilFunc",()=>u.LessEqualStencilFunc,"LessStencilFunc",()=>u.LessStencilFunc,"Light",()=>u.Light,"LightProbe",()=>u.LightProbe,"Line",()=>u.Line,"Line3",()=>u.Line3,"LineBasicMaterial",()=>u.LineBasicMaterial,"LineCurve",()=>u.LineCurve,"LineCurve3",()=>u.LineCurve3,"LineDashedMaterial",()=>u.LineDashedMaterial,"LineLoop",()=>u.LineLoop,"LineSegments",()=>u.LineSegments,"LinearFilter",()=>u.LinearFilter,"LinearInterpolant",()=>u.LinearInterpolant,"LinearMipMapLinearFilter",()=>u.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>u.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>u.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>u.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>u.LinearSRGBColorSpace,"LinearToneMapping",()=>u.LinearToneMapping,"LinearTransfer",()=>u.LinearTransfer,"Loader",()=>u.Loader,"LoaderUtils",()=>u.LoaderUtils,"LoadingManager",()=>u.LoadingManager,"LoopOnce",()=>u.LoopOnce,"LoopPingPong",()=>u.LoopPingPong,"LoopRepeat",()=>u.LoopRepeat,"MOUSE",()=>u.MOUSE,"Material",()=>u.Material,"MaterialLoader",()=>u.MaterialLoader,"MathUtils",()=>u.MathUtils,"Matrix2",()=>u.Matrix2,"Matrix3",()=>u.Matrix3,"Matrix4",()=>u.Matrix4,"MaxEquation",()=>u.MaxEquation,"Mesh",()=>u.Mesh,"MeshBasicMaterial",()=>u.MeshBasicMaterial,"MeshDepthMaterial",()=>u.MeshDepthMaterial,"MeshDistanceMaterial",()=>u.MeshDistanceMaterial,"MeshLambertMaterial",()=>u.MeshLambertMaterial,"MeshMatcapMaterial",()=>u.MeshMatcapMaterial,"MeshNormalMaterial",()=>u.MeshNormalMaterial,"MeshPhongMaterial",()=>u.MeshPhongMaterial,"MeshPhysicalMaterial",()=>u.MeshPhysicalMaterial,"MeshStandardMaterial",()=>u.MeshStandardMaterial,"MeshToonMaterial",()=>u.MeshToonMaterial,"MinEquation",()=>u.MinEquation,"MirroredRepeatWrapping",()=>u.MirroredRepeatWrapping,"MixOperation",()=>u.MixOperation,"MultiplyBlending",()=>u.MultiplyBlending,"MultiplyOperation",()=>u.MultiplyOperation,"NearestFilter",()=>u.NearestFilter,"NearestMipMapLinearFilter",()=>u.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>u.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>u.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>u.NearestMipmapNearestFilter,"NeutralToneMapping",()=>u.NeutralToneMapping,"NeverCompare",()=>u.NeverCompare,"NeverDepth",()=>u.NeverDepth,"NeverStencilFunc",()=>u.NeverStencilFunc,"NoBlending",()=>u.NoBlending,"NoColorSpace",()=>u.NoColorSpace,"NoNormalPacking",()=>u.NoNormalPacking,"NoToneMapping",()=>u.NoToneMapping,"NormalAnimationBlendMode",()=>u.NormalAnimationBlendMode,"NormalBlending",()=>u.NormalBlending,"NormalGAPacking",()=>u.NormalGAPacking,"NormalRGPacking",()=>u.NormalRGPacking,"NotEqualCompare",()=>u.NotEqualCompare,"NotEqualDepth",()=>u.NotEqualDepth,"NotEqualStencilFunc",()=>u.NotEqualStencilFunc,"NumberKeyframeTrack",()=>u.NumberKeyframeTrack,"Object3D",()=>u.Object3D,"ObjectLoader",()=>u.ObjectLoader,"ObjectSpaceNormalMap",()=>u.ObjectSpaceNormalMap,"OctahedronGeometry",()=>u.OctahedronGeometry,"OneFactor",()=>u.OneFactor,"OneMinusConstantAlphaFactor",()=>u.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>u.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>u.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>u.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>u.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>u.OneMinusSrcColorFactor,"OrthographicCamera",()=>u.OrthographicCamera,"PCFShadowMap",()=>u.PCFShadowMap,"PCFSoftShadowMap",()=>u.PCFSoftShadowMap,"PMREMGenerator",()=>l.PMREMGenerator,"Path",()=>u.Path,"PerspectiveCamera",()=>u.PerspectiveCamera,"Plane",()=>u.Plane,"PlaneGeometry",()=>u.PlaneGeometry,"PlaneHelper",()=>u.PlaneHelper,"PointLight",()=>u.PointLight,"PointLightHelper",()=>u.PointLightHelper,"Points",()=>u.Points,"PointsMaterial",()=>u.PointsMaterial,"PolarGridHelper",()=>u.PolarGridHelper,"PolyhedronGeometry",()=>u.PolyhedronGeometry,"PositionalAudio",()=>u.PositionalAudio,"PropertyBinding",()=>u.PropertyBinding,"PropertyMixer",()=>u.PropertyMixer,"QuadraticBezierCurve",()=>u.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>u.QuadraticBezierCurve3,"Quaternion",()=>u.Quaternion,"QuaternionKeyframeTrack",()=>u.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>u.QuaternionLinearInterpolant,"R11_EAC_Format",()=>u.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>u.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>u.RED_RGTC1_Format,"REVISION",()=>u.REVISION,"RG11_EAC_Format",()=>u.RG11_EAC_Format,"RGBADepthPacking",()=>u.RGBADepthPacking,"RGBAFormat",()=>u.RGBAFormat,"RGBAIntegerFormat",()=>u.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>u.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>u.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>u.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>u.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>u.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>u.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>u.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>u.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>u.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>u.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>u.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>u.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>u.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>u.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>u.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>u.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>u.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>u.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>u.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>u.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>u.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>u.RGBDepthPacking,"RGBFormat",()=>u.RGBFormat,"RGBIntegerFormat",()=>u.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>u.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>u.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>u.RGB_ETC1_Format,"RGB_ETC2_Format",()=>u.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>u.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>u.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>u.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>u.RGDepthPacking,"RGFormat",()=>u.RGFormat,"RGIntegerFormat",()=>u.RGIntegerFormat,"RawShaderMaterial",()=>u.RawShaderMaterial,"Ray",()=>u.Ray,"Raycaster",()=>u.Raycaster,"RectAreaLight",()=>u.RectAreaLight,"RedFormat",()=>u.RedFormat,"RedIntegerFormat",()=>u.RedIntegerFormat,"ReinhardToneMapping",()=>u.ReinhardToneMapping,"RenderTarget",()=>u.RenderTarget,"RenderTarget3D",()=>u.RenderTarget3D,"RepeatWrapping",()=>u.RepeatWrapping,"ReplaceStencilOp",()=>u.ReplaceStencilOp,"ReverseSubtractEquation",()=>u.ReverseSubtractEquation,"RingGeometry",()=>u.RingGeometry,"SIGNED_R11_EAC_Format",()=>u.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>u.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>u.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>u.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>u.SRGBColorSpace,"SRGBTransfer",()=>u.SRGBTransfer,"Scene",()=>u.Scene,"ShaderChunk",()=>l.ShaderChunk,"ShaderLib",()=>l.ShaderLib,"ShaderMaterial",()=>u.ShaderMaterial,"ShadowMaterial",()=>u.ShadowMaterial,"Shape",()=>u.Shape,"ShapeGeometry",()=>u.ShapeGeometry,"ShapePath",()=>u.ShapePath,"ShapeUtils",()=>u.ShapeUtils,"ShortType",()=>u.ShortType,"Skeleton",()=>u.Skeleton,"SkeletonHelper",()=>u.SkeletonHelper,"SkinnedMesh",()=>u.SkinnedMesh,"Source",()=>u.Source,"Sphere",()=>u.Sphere,"SphereGeometry",()=>u.SphereGeometry,"Spherical",()=>u.Spherical,"SphericalHarmonics3",()=>u.SphericalHarmonics3,"SplineCurve",()=>u.SplineCurve,"SpotLight",()=>u.SpotLight,"SpotLightHelper",()=>u.SpotLightHelper,"Sprite",()=>u.Sprite,"SpriteMaterial",()=>u.SpriteMaterial,"SrcAlphaFactor",()=>u.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>u.SrcAlphaSaturateFactor,"SrcColorFactor",()=>u.SrcColorFactor,"StaticCopyUsage",()=>u.StaticCopyUsage,"StaticDrawUsage",()=>u.StaticDrawUsage,"StaticReadUsage",()=>u.StaticReadUsage,"StereoCamera",()=>u.StereoCamera,"StreamCopyUsage",()=>u.StreamCopyUsage,"StreamDrawUsage",()=>u.StreamDrawUsage,"StreamReadUsage",()=>u.StreamReadUsage,"StringKeyframeTrack",()=>u.StringKeyframeTrack,"SubtractEquation",()=>u.SubtractEquation,"SubtractiveBlending",()=>u.SubtractiveBlending,"TOUCH",()=>u.TOUCH,"TangentSpaceNormalMap",()=>u.TangentSpaceNormalMap,"TetrahedronGeometry",()=>u.TetrahedronGeometry,"Texture",()=>u.Texture,"TextureLoader",()=>u.TextureLoader,"TextureUtils",()=>u.TextureUtils,"Timer",()=>u.Timer,"TimestampQuery",()=>u.TimestampQuery,"TorusGeometry",()=>u.TorusGeometry,"TorusKnotGeometry",()=>u.TorusKnotGeometry,"Triangle",()=>u.Triangle,"TriangleFanDrawMode",()=>u.TriangleFanDrawMode,"TriangleStripDrawMode",()=>u.TriangleStripDrawMode,"TrianglesDrawMode",()=>u.TrianglesDrawMode,"TubeGeometry",()=>u.TubeGeometry,"UVMapping",()=>u.UVMapping,"Uint16BufferAttribute",()=>u.Uint16BufferAttribute,"Uint32BufferAttribute",()=>u.Uint32BufferAttribute,"Uint8BufferAttribute",()=>u.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>u.Uint8ClampedBufferAttribute,"Uniform",()=>u.Uniform,"UniformsGroup",()=>u.UniformsGroup,"UniformsLib",()=>l.UniformsLib,"UniformsUtils",()=>u.UniformsUtils,"UnsignedByteType",()=>u.UnsignedByteType,"UnsignedInt101111Type",()=>u.UnsignedInt101111Type,"UnsignedInt248Type",()=>u.UnsignedInt248Type,"UnsignedInt5999Type",()=>u.UnsignedInt5999Type,"UnsignedIntType",()=>u.UnsignedIntType,"UnsignedShort4444Type",()=>u.UnsignedShort4444Type,"UnsignedShort5551Type",()=>u.UnsignedShort5551Type,"UnsignedShortType",()=>u.UnsignedShortType,"VSMShadowMap",()=>u.VSMShadowMap,"Vector2",()=>u.Vector2,"Vector3",()=>u.Vector3,"Vector4",()=>u.Vector4,"VectorKeyframeTrack",()=>u.VectorKeyframeTrack,"VideoFrameTexture",()=>u.VideoFrameTexture,"VideoTexture",()=>u.VideoTexture,"WebGL3DRenderTarget",()=>u.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>u.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>u.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>u.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>u.WebGLRenderTarget,"WebGLRenderer",()=>l.WebGLRenderer,"WebGLUtils",()=>l.WebGLUtils,"WebGPUCoordinateSystem",()=>u.WebGPUCoordinateSystem,"WebXRController",()=>u.WebXRController,"WireframeGeometry",()=>u.WireframeGeometry,"WrapAroundEnding",()=>u.WrapAroundEnding,"ZeroCurvatureEnding",()=>u.ZeroCurvatureEnding,"ZeroFactor",()=>u.ZeroFactor,"ZeroSlopeEnding",()=>u.ZeroSlopeEnding,"ZeroStencilOp",()=>u.ZeroStencilOp,"createCanvasElement",()=>u.createCanvasElement,"error",()=>u.error,"getConsoleFunction",()=>u.getConsoleFunction,"log",()=>u.log,"setConsoleFunction",()=>u.setConsoleFunction,"warn",()=>u.warn,"warnOnce",()=>u.warnOnce],32009);var c=e.i(32009);function d(e,t){let r;return(...a)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...a),t)}}let f=["x","y","top","bottom","left","right","width","height"];var h=e.i(46791);function m({ref:e,children:t,fallback:r,resize:a,style:i,gl:l,events:u=s.f,eventSource:h,eventPrefix:m,shadows:p,linear:g,flat:v,legacy:y,orthographic:A,frameloop:F,dpr:b,performance:C,raycaster:B,camera:S,scene:x,onPointerMissed:E,onCreated:M,...D}){o.useMemo(()=>(0,s.e)(c),[]);let k=(0,s.u)(),[w,I]=function({debounce:e,scroll:t,polyfill:r,offsetSize:a}={debounce:0,scroll:!1,offsetSize:!1}){var n,i,s;let l=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!l)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[u,c]=(0,o.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=(0,o.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u,orientationHandler:null}),m=e?"number"==typeof e?e:e.scroll:null,p=e?"number"==typeof e?e:e.resize:null,g=(0,o.useRef)(!1);(0,o.useEffect)(()=>(g.current=!0,()=>void(g.current=!1)));let[v,y,A]=(0,o.useMemo)(()=>{let e=()=>{let e,t;if(!h.current.element)return;let{left:r,top:n,width:i,height:o,bottom:s,right:l,x:u,y:d}=h.current.element.getBoundingClientRect(),m={left:r,top:n,width:i,height:o,bottom:s,right:l,x:u,y:d};h.current.element instanceof HTMLElement&&a&&(m.height=h.current.element.offsetHeight,m.width=h.current.element.offsetWidth),Object.freeze(m),g.current&&(e=h.current.lastBounds,t=m,!f.every(r=>e[r]===t[r]))&&c(h.current.lastBounds=m)};return[e,p?d(e,p):e,m?d(e,m):e]},[c,a,m,p]);function F(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",A,!0)),h.current.scrollContainers=null),h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null),h.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",h.current.orientationHandler))}function b(){h.current.element&&(h.current.resizeObserver=new l(A),h.current.resizeObserver.observe(h.current.element),t&&h.current.scrollContainers&&h.current.scrollContainers.forEach(e=>e.addEventListener("scroll",A,{capture:!0,passive:!0})),h.current.orientationHandler=()=>{A()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",h.current.orientationHandler))}return n=A,i=!!t,(0,o.useEffect)(()=>{if(i)return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)},[n,i]),s=y,(0,o.useEffect)(()=>(window.addEventListener("resize",s),()=>void window.removeEventListener("resize",s)),[s]),(0,o.useEffect)(()=>{F(),b()},[t,A,y]),(0,o.useEffect)(()=>F,[]),[e=>{e&&e!==h.current.element&&(F(),h.current.element=e,h.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:a,overflowX:n,overflowY:i}=window.getComputedStyle(t);return[a,n,i].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),b())},u,v]}({scroll:!0,debounce:{scroll:50,resize:0},...a}),T=o.useRef(null),R=o.useRef(null);o.useImperativeHandle(e,()=>T.current);let P=(0,s.a)(E),[G,L]=o.useState(!1),[j,_]=o.useState(!1);if(G)throw G;if(j)throw j;let O=o.useRef(null);(0,s.b)(()=>{let e=T.current;I.width>0&&I.height>0&&e&&(O.current||(O.current=(0,s.c)(e)),async function(){await O.current.configure({gl:l,scene:x,events:u,shadows:p,linear:g,flat:v,legacy:y,orthographic:A,frameloop:F,dpr:b,performance:C,raycaster:B,camera:S,size:I,onPointerMissed:(...e)=>null==P.current?void 0:P.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(h?(0,s.i)(h)?h.current:h:R.current),m&&e.setEvents({compute:(e,t)=>{let r=e[m+"X"],a=e[m+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(a/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==M||M(e)}}),O.current.render((0,n.jsx)(k,{children:(0,n.jsx)(s.E,{set:_,children:(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)(s.B,{set:L}),children:null!=t?t:null})})}))}())}),o.useEffect(()=>{let e=T.current;if(e)return()=>(0,s.d)(e)},[]);let U=h?"none":"auto";return(0,n.jsx)("div",{ref:R,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:U,...i},...D,children:(0,n.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,n.jsx)("canvas",{ref:T,style:{display:"block"},children:r})})})}function p(e){return(0,n.jsx)(h.FiberProvider,{children:(0,n.jsx)(m,{...e})})}e.i(39695),e.i(98133),e.i(95087);var g=e.i(66027),v=e.i(54970),y=e.i(12979),A=e.i(49774),F=e.i(73949),b=e.i(62395),C=e.i(75567),B=e.i(47071);let S={value:!0},x=` +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 E=e.i(79123),M=e.i(47021),D=e.i(48066);let k={0:32,1:32,2:32,3:32,4:32,5:32};function w({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:a,detailTextureName:i,lightmap:s}){let{debugMode:l}=(0,E.useDebug)(),c=(0,B.useTexture)(r.map(e=>(0,y.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,C.setupTexture)(e))}),d=i?(0,y.textureToUrl)(i):null,f=(0,B.useTexture)(d??y.FALLBACK_TEXTURE_URL,e=>{(0,C.setupTexture)(e)}),h=(0,o.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:a,tiling:n,detailTexture:i=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=S;let s=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),a&&(e.uniforms.visibilityMask={value:a}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:n[r]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),i&&(e.uniforms.detailTexture={value:i},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; +${a?"uniform sampler2D visibilityMask;":""} +${o?"uniform sampler2D terrainLightmap;":""} +uniform bool sunLightPointsDown; +${i?`uniform sampler2D detailTexture; +uniform float detailTiling; +uniform float detailFadeDistance; +varying vec3 vTerrainWorldPos;`:""} + +${x} + +// Global variable to store shadow factor from RE_Direct for use in output calculation +float terrainShadowFactor = 1.0; +`+e.fragmentShader,a){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; + ${s>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""} + ${s>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""} + ${s>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""} + ${s>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""} + ${s>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; + ${s>1?"float a1 = texture2D(mask1, alphaUv).r;":""} + ${s>2?"float a2 = texture2D(mask2, alphaUv).r;":""} + ${s>3?"float a3 = texture2D(mask3, alphaUv).r;":""} + ${s>4?"float a4 = texture2D(mask4, alphaUv).r;":""} + ${s>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; + ${s>1?"blended += c1 * a1;":""} + ${s>2?"blended += c2 * a2;":""} + ${s>3?"blended += c3 * a3;":""} + ${s>4?"blended += c4 * a4;":""} + ${s>5?"blended += c5 * a5;":""} + + // Assign to diffuseColor before lighting + vec3 textureColor = blended; + + ${i?`// 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; +`),o&&(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); + + ${o?` + // 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:c,alphaTextures:a,visibilityMask:t,tiling:k,detailTexture:d?f:null,lightmap:s}),(0,M.injectCustomFog)(e,D.globalFogUniforms)},[c,a,t,f,d,s]),m=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=m.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!l,e.needsUpdate=!0)},[l]);let p=`${d?"detail":"nodetail"}-${s?"lightmap":"nolightmap"}`;return(0,n.jsx)("meshLambertMaterial",{ref:m,map:e,depthWrite:!0,side:u.FrontSide,defines:{DEBUG_MODE:+!!l},onBeforeCompile:h},p)}function I(e){let t,r,a=(0,i.c)(8),{displacementMap:s,visibilityMask:l,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),a[0]=t):t=a[0],a[1]!==c||a[2]!==d||a[3]!==s||a[4]!==f||a[5]!==u||a[6]!==l?(r=(0,n.jsx)(o.Suspense,{fallback:t,children:(0,n.jsx)(w,{displacementMap:s,visibilityMask:l,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f})}),a[1]=c,a[2]=d,a[3]=s,a[4]=f,a[5]=u,a[6]=l,a[7]=r):r=a[7],r}let T=(0,o.memo)(function(e){let t,r,a,o=(0,i.c)(15),{tileX:s,tileZ:l,blockSize:u,basePosition:c,textureNames:d,geometry:f,displacementMap:h,visibilityMask:m,alphaTextures:p,detailTextureName:g,lightmap:v,visible:y}=e,A=void 0===y||y,F=u/2,b=c.x+s*u+F,C=c.z+l*u+F;o[0]!==b||o[1]!==C?(t=[b,0,C],o[0]=b,o[1]=C,o[2]=t):t=o[2];let B=t;return o[3]!==p||o[4]!==g||o[5]!==h||o[6]!==v||o[7]!==d||o[8]!==m?(r=(0,n.jsx)(I,{displacementMap:h,visibilityMask:m,textureNames:d,alphaTextures:p,detailTextureName:g,lightmap:v}),o[3]=p,o[4]=g,o[5]=h,o[6]=v,o[7]=d,o[8]=m,o[9]=r):r=o[9],o[10]!==f||o[11]!==B||o[12]!==r||o[13]!==A?(a=(0,n.jsx)("mesh",{position:B,geometry:f,castShadow:!0,receiveShadow:!0,visible:A,children:r}),o[10]=f,o[11]=B,o[12]=r,o[13]=A,o[14]=a):a=o[14],a});e.i(13876);var R=e.i(58647);function P(e){return(0,R.useRuntimeObjectByName)(e)}function G(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,a=r>>8&255,n=r>>16,i=256*a;for(let r=0;r0?a:(t[0]!==r?(e=(0,b.getFloat)(r,"visibleDistance")??600,t[0]=r,t[1]=e):e=t[1],e)}(),z=(0,F.useThree)(j),q=-(128*N);I[6]!==q?(s={x:q,z:q},I[6]=q,I[7]=s):s=I[7];let Q=s;if(I[8]!==R){let e=(0,b.getProperty)(R,"emptySquares");l=e?e.split(" ").map(_):[],I[8]=R,I[9]=l}else l=I[9];let W=l,{data:X}=((w=(0,i.c)(2))[0]!==L?(k={queryKey:["terrain",L],queryFn:()=>(0,y.loadTerrain)(L)},w[0]=L,w[1]=k):k=w[1],(0,g.useQuery)(k));e:{let e;if(!X){c=null;break e}let t=256*N;I[10]!==t||I[11]!==N||I[12]!==X.heightMap?(!function(e,t,r){let a=e.attributes.position,n=e.attributes.uv,i=e.attributes.normal,o=a.array,s=n.array,l=i.array,u=a.count,c=(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 a=Math.floor(e=Math.max(0,Math.min(255,e))),n=Math.floor(r=Math.max(0,Math.min(255,r))),i=Math.min(a+1,255),o=Math.min(n+1,255),s=e-a,l=r-n;return(t[256*n+a]/65535*2048*(1-s)+t[256*n+i]/65535*2048*s)*(1-l)+(t[256*o+a]/65535*2048*(1-s)+t[256*o+i]/65535*2048*s)*l};for(let e=0;e0?(m/=v,p/=v,g/=v):(m=0,p=1,g=0),l[3*e]=m,l[3*e+1]=p,l[3*e+2]=g}a.needsUpdate=!0,i.needsUpdate=!0}(e=function(e,t){let r=new u.BufferGeometry,a=new Float32Array(198147),n=new Float32Array(198147),i=new Float32Array(132098),o=new Uint32Array(393216),s=0,l=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let o=257*t+r;a[3*o]=r*l-e/2,a[3*o+1]=e/2-t*l,a[3*o+2]=0,n[3*o]=0,n[3*o+1]=0,n[3*o+2]=1,i[2*o]=r/256,i[2*o+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,a=r+1,n=(e+1)*257+t,i=n+1;((t^e)&1)==0?(o[s++]=r,o[s++]=n,o[s++]=i,o[s++]=r,o[s++]=i,o[s++]=a):(o[s++]=r,o[s++]=n,o[s++]=a,o[s++]=a,o[s++]=n,o[s++]=i)}return r.setIndex(new u.BufferAttribute(o,1)),r.setAttribute("position",new u.Float32BufferAttribute(a,3)),r.setAttribute("normal",new u.Float32BufferAttribute(n,3)),r.setAttribute("uv",new u.Float32BufferAttribute(i,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),X.heightMap,N),I[10]=t,I[11]=N,I[12]=X.heightMap,I[13]=e):e=I[13],c=e}let Y=c,Z=P("Sun");t:{let e,t;if(!Z){let e;I[14]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3(.57735,-.57735,.57735),I[14]=e):e=I[14],d=e;break t}I[15]!==Z?(e=((0,b.getProperty)(Z,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(O),I[15]=Z,I[16]=e):e=I[16];let[r,a,n]=e,i=Math.sqrt(r*r+n*n+a*a),o=r/i,s=n/i,l=a/i;I[17]!==s||I[18]!==l||I[19]!==o?(t=new u.Vector3(o,s,l),I[17]=s,I[18]=l,I[19]=o,I[20]=t):t=I[20],d=t}let $=d;r:{let e;if(!X){f=null;break r}I[21]!==N||I[22]!==$||I[23]!==X.heightMap?(e=function(e,t,r){let a=(t,r)=>{let a=Math.max(0,Math.min(255,t)),n=Math.max(0,Math.min(255,r)),i=Math.floor(a),o=Math.floor(n),s=Math.min(i+1,255),l=Math.min(o+1,255),u=a-i,c=n-o;return((e[256*o+i]/65535*(1-u)+e[256*o+s]/65535*u)*(1-c)+(e[256*l+i]/65535*(1-u)+e[256*l+s]/65535*u)*c)*2048},n=new u.Vector3(-t.x,-t.y,-t.z).normalize(),i=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,s=e/2+.25,l=a(o,s),u=a(o-.5,s),c=a(o+.5,s),d=a(o,s-.5),f=-((a(o,s+.5)-d)/1),h=-((c-u)/1),m=Math.sqrt(f*f+r*r+h*h),p=Math.max(0,f/m*n.x+r/m*n.y+h/m*n.z),g=1;p>0&&(g=function(e,t,r,a,n,i){let o=a.z/n,s=a.x/n,l=a.y,u=Math.sqrt(o*o+s*s);if(u<1e-4)return 1;let c=.5/u,d=o*c,f=s*c,h=l*c,m=e,p=t,g=r+.1;for(let e=0;e<768&&(m+=d,p+=f,g+=h,!(m<0)&&!(m>=256)&&!(p<0)&&!(p>=256)&&!(g>2048));e++)if(gArray(eo).fill(null),I[34]=eo,I[35]=B):B=I[35];let[el,eu]=(0,o.useState)(B);I[36]===Symbol.for("react.memo_cache_sentinel")?(S={xStart:0,xEnd:0,zStart:0,zEnd:0},I[36]=S):S=I[36];let ec=(0,o.useRef)(S);return(I[37]!==Q.x||I[38]!==Q.z||I[39]!==K||I[40]!==z.position.x||I[41]!==z.position.z||I[42]!==eo||I[43]!==V?(x=()=>{let e=z.position.x-Q.x,t=z.position.z-Q.z,r=Math.floor((e-V)/K),a=Math.ceil((e+V)/K),n=Math.floor((t-V)/K),i=Math.ceil((t+V)/K),o=ec.current;if(r===o.xStart&&a===o.xEnd&&n===o.zStart&&i===o.zEnd)return;o.xStart=r,o.xEnd=a,o.zStart=n,o.zEnd=i;let s=[];for(let e=r;e{let t=el[e];return(0,n.jsx)(T,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:K,basePosition:Q,textureNames:X.textureNames,geometry:Y,displacementMap:et,visibilityMask:ea,alphaTextures:en,detailTextureName:J,lightmap:ee,visible:null!==t},e)}),I[55]=Q,I[56]=K,I[57]=J,I[58]=es,I[59]=en,I[60]=et,I[61]=Y,I[62]=X.textureNames,I[63]=ee,I[64]=el,I[65]=M):M=I[65],I[66]!==E||I[67]!==M?(D=(0,n.jsxs)(n.Fragment,{children:[E,M]}),I[66]=E,I[67]=M,I[68]=D):D=I[68],D):null});function j(e){return e.camera}function _(e){return parseInt(e,10)}function O(e){return parseFloat(e)}function U(e){return(0,C.setupMask)(e)}function H(e,t){return t}let N=(0,o.createContext)(null);function J(){return(0,o.useContext)(N)}function K(e){return(0,n.jsx)(t6,{objectId:e},e)}var V=o;let z=(0,V.createContext)(null),q={didCatch:!1,error:null};class Q extends V.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=q}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(q))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:a}=this.props;r&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,a)&&(this.props.onReset?.({next:a,prev:e.resetKeys,reason:"keys"}),this.setState(q))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:a}=this.props,{didCatch:n,error:i}=this.state,o=e;if(n){let e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,V.createElement)(r,e);else if(void 0!==a)o=a;else throw i}return(0,V.createElement)(z.Provider,{value:{didCatch:n,error:i,resetErrorBoundary:this.resetErrorBoundary}},o)}}var W=e.i(31067),X=u;function Y(e,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==u.TriangleFanDrawMode&&t!==u.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let s=new eK(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(i),s.setPlugins(o),s.parse(r,a)}parseAsync(e,t){let r=this;return new Promise(function(a,n){r.parse(e,t,a,n)})}}function ea(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let en={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ei{constructor(e){this.parser=e,this.name=en.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,a=t.length;r=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,i)}}class eA{constructor(e){this.parser=e,this.name=en.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,a=r.json,n=a.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=a.images[i.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,s);if(a.extensionsRequired&&a.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class eF{constructor(e){this.parser=e,this.name=en.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,a=r.json,n=a.textures[e];if(!n.extensions||!n.extensions[t])return null;let i=n.extensions[t],o=a.images[i.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i.source,s);if(a.extensionsRequired&&a.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class eb{constructor(e){this.name=en.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],a=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return a.then(function(t){let r=e.byteOffset||0,a=e.byteLength||0,i=e.count,o=e.byteStride,s=new Uint8Array(t,r,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,o,s,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(i*o);return n.decodeGltfBuffer(new Uint8Array(t),i,o,s,e.mode,e.filter),t})})}}}class eC{constructor(e){this.name=en.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==eI.TRIANGLES&&e.mode!==eI.TRIANGLE_STRIP&&e.mode!==eI.TRIANGLE_FAN&&void 0!==e.mode)return null;let a=r.extensions[this.name].attributes,n=[],i={};for(let e in a)n.push(this.parser.getDependency("accessor",a[e]).then(t=>(i[e]=t,i[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],a=e[0].count,n=[];for(let e of r){let t=new X.Matrix4,r=new X.Vector3,o=new X.Quaternion,s=new X.Vector3(1,1,1),l=new X.InstancedMesh(e.geometry,e.material,a);for(let e=0;e=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},ej={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},e_={CUBICSPLINE:void 0,LINEAR:X.InterpolateLinear,STEP:X.InterpolateDiscrete};function eO(e,t,r){for(let a in r.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=r.extensions[a])}function eU(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function eH(e){let t="",r=Object.keys(e).sort();for(let a=0,n=r.length;a-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||a&&n<98?this.textureLoader=new X.TextureLoader(this.options.manager):this.textureLoader=new X.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new X.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,a=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let i={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:r,userData:{}};return eO(n,i,a),eU(i,a),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(i)})).then(function(){for(let e of i.scenes)e.updateMatrixWorld();e(i)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,a=t.length;r{let r=this.associations.get(e);for(let[a,i]of(null!=r&&this.associations.set(t,r),e.children.entries()))n(i,t.children[a])};return n(r,a),a.name+="_instance_"+e.uses[t]++,a}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&i.setY(t,d[e*s+1]),s>=3&&i.setZ(t,d[e*s+2]),s>=4&&i.setW(t,d[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})}loadTexture(e){let t=this.json,r=this.options,a=t.textures[e].source,n=t.images[a],i=this.textureLoader;if(n.uri){let e=r.manager.getHandler(n.uri);null!==e&&(i=e)}return this.loadTextureImage(e,a,i)}loadTextureImage(e,t,r){let a=this,n=this.json,i=n.textures[e],o=n.images[t],s=(o.uri||o.bufferView)+":"+i.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=i.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(n.samplers||{})[i.sampler]||{};return t.magFilter=eR[r.magFilter]||X.LinearFilter,t.minFilter=eR[r.minFilter]||X.LinearMipmapLinearFilter,t.wrapS=eP[r.wrapS]||X.RepeatWrapping,t.wrapT=eP[r.wrapT]||X.RepeatWrapping,a.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){let r=this.json,a=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let n=r.images[e],i=self.URL||self.webkitURL,o=n.uri||"",s=!1;if(void 0!==n.bufferView)o=this.getDependency("bufferView",n.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:n.mimeType});return o=i.createObjectURL(t)});else if(void 0===n.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(e){return new Promise(function(r,n){let i=r;!0===t.isImageBitmapLoader&&(i=function(e){let t=new X.Texture(e);t.needsUpdate=!0,r(t)}),t.load(X.LoaderUtils.resolveURL(e,a.path),i,void 0,n)})}).then(function(e){var t;return!0===s&&i.revokeObjectURL(o),eU(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,a){let n=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((i=i.clone()).channel=r.texCoord),n.extensions[en.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[en.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(i);i=n.extensions[en.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),n.associations.set(i,t)}}return void 0!==a&&("number"==typeof a&&(a=3001===a?ee:et),"colorSpace"in i?i.colorSpace=a:i.encoding=a===ee?3001:3e3),e[t]=i,i})}assignFinalMaterial(e){let t=e.geometry,r=e.material,a=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,i=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new X.PointsMaterial,X.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new X.LineBasicMaterial,X.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(a||n||i){let e="ClonedMaterial:"+r.uuid+":";a&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),i&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),n&&(t.vertexColors=!0),i&&(t.flatShading=!0),a&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return X.MeshStandardMaterial}loadMaterial(e){let t,r=this,a=this.json,n=this.extensions,i=a.materials[e],o={},s=i.extensions||{},l=[];if(s[en.KHR_MATERIALS_UNLIT]){let e=n[en.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,i,r))}else{let a=i.pbrMetallicRoughness||{};if(o.color=new X.Color(1,1,1),o.opacity=1,Array.isArray(a.baseColorFactor)){let e=a.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],et),o.opacity=e[3]}void 0!==a.baseColorTexture&&l.push(r.assignTexture(o,"map",a.baseColorTexture,ee)),o.metalness=void 0!==a.metallicFactor?a.metallicFactor:1,o.roughness=void 0!==a.roughnessFactor?a.roughnessFactor:1,void 0!==a.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",a.metallicRoughnessTexture)),l.push(r.assignTexture(o,"roughnessMap",a.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===i.doubleSided&&(o.side=X.DoubleSide);let u=i.alphaMode||"OPAQUE";if("BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&t!==X.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",i.normalTexture)),o.normalScale=new X.Vector2(1,1),void 0!==i.normalTexture.scale)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&t!==X.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(o.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&t!==X.MeshBasicMaterial){let e=i.emissiveFactor;o.emissive=new X.Color().setRGB(e[0],e[1],e[2],et)}return void 0!==i.emissiveTexture&&t!==X.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",i.emissiveTexture,ee)),Promise.all(l).then(function(){let a=new t(o);return i.name&&(a.name=i.name),eU(a,i),r.associations.set(a,{materials:e}),i.extensions&&eO(n,a,i),a})}createUniqueName(e){let t=X.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,a=this.primitiveCache,n=[];for(let i=0,o=e.length;i0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,a=t.weights.length;r1?new X.Group:1===t.length?t[0]:new X.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of a.associations)(e instanceof X.Material||e instanceof X.Texture)&&t.set(e,r);return e.traverse(e=>{let r=a.associations.get(e);null!=r&&t.set(e,r)}),t})(n),n})}_createAnimationTracks(e,t,r,a,n){let i,o=[],s=e.name?e.name:e.uuid,l=[];switch(ej[n.path]===ej.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),ej[n.path]){case ej.weights:i=X.NumberKeyframeTrack;break;case ej.rotation:i=X.QuaternionKeyframeTrack;break;case ej.position:case ej.scale:i=X.VectorKeyframeTrack;break;default:i=1===r.itemSize?X.NumberKeyframeTrack:X.VectorKeyframeTrack}let u=void 0!==a.interpolation?e_[a.interpolation]:X.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(a)},r,a)}decodeDracoFile(e,t,r,a){let n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let a=JSON.stringify(t);if(eq.has(e)){let t=eq.get(e);if(t.key===a)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,i=e.byteLength,o=this._getWorker(n,i).then(a=>(r=a,new Promise((a,i)=>{r._callbacks[n]={resolve:a,reject:i},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),eq.set(e,{key:a,promise:o}),o}_createGeometry(e){let t=new ez.BufferGeometry;e.index&&t.setIndex(new ez.BufferAttribute(e.index.array,1));for(let r=0;r{r.load(e,t,void 0,a)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let a=eW.toString(),n=["/* draco decoder */",r,"\n/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(n),n.byteLength);try{let e=function(e,t,r,a){var n,i,o;let s,l,u,c,d,f,h=a.attributeIDs,m=a.attributeTypes,p=t.GetEncodedGeometryType(r);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(p===e.POINT_CLOUD)d=new e.PointCloud,f=t.DecodeBufferToPointCloud(r,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let g={index:null,attributes:[]};for(let r in h){let n,i,o=self[m[r]];if(a.useUniqueIDs)i=h[r],n=t.GetAttributeByUniqueId(d,i);else{if(-1===(i=t.GetAttributeId(d,e[h[r]])))continue;n=t.GetAttribute(d,i)}g.attributes.push(function(e,t,r,a,n,i){let o=i.num_components(),s=r.num_points()*o,l=s*n.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,i,u,l,c);let d=new n(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:a,array:d,itemSize:o}}(e,t,d,r,o,n))}return p===e.TRIANGULAR_MESH&&(n=e,i=t,o=d,s=3*o.num_faces(),l=4*s,u=n._malloc(l),i.GetTrianglesUInt32Array(o,l,u),c=new Uint32Array(n.HEAPF32.buffer,u,s).slice(),n._free(u),g.index={array:c,itemSize:1}),e.destroy(d),g}(t,r,o,i),n=e.attributes.map(e=>e.array.buffer);e.index&&n.push(e.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:e},n)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}var eX=e.i(971);let eY=function(e){let t=new Map,r=new Map,a=e.clone();return function e(t,r,a){a(t,r);for(let n=0;n{let f={keys:l,deep:a,inject:s,castShadow:n,receiveShadow:i};if(Array.isArray(t=o.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return eY(t)}return t},[t,e])))return o.createElement("group",(0,W.default)({},c,{ref:d}),t.map(e=>o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f))),r);let{children:h,...m}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:a,castShadow:n,receiveShadow:i}){let s={};for(let r of t)s[r]=e[r];return r&&(s.geometry&&"materialsOnly"!==r&&(s.geometry=s.geometry.clone()),s.material&&"geometriesOnly"!==r&&(s.material=s.material.clone())),a&&(s="function"==typeof a?{...s,children:a(e)}:o.isValidElement(a)?{...s,children:a}:{...s,...a}),e instanceof u.Mesh&&(n&&(s.castShadow=!0),i&&(s.receiveShadow=!0)),s}(t,f),p=t.type[0].toLowerCase()+t.type.slice(1);return o.createElement(p,(0,W.default)({},m,c,{ref:d}),t.children.map(e=>"Bone"===e.type?o.createElement("primitive",(0,W.default)({key:e.uuid,object:e},f)):o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f,{isChild:!0}))),r,h)}),e$=null,e0="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function e1(e=!0,r=!0,a){return n=>{a&&a(n),e&&(e$||(e$=new eQ),e$.setDecoderPath("string"==typeof e?e:e0),n.setDRACOLoader(e$)),r&&n.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),a=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(r)&&(n="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");let i=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r96?a-71:a>64?a-65:a>47?a+4:a>46?63:62}let r=0;for(let n=0;n{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,a,n,i,o){let s=e.exports.sbrk,l=a+3&-4,u=s(l*n),c=s(i.length),d=new Uint8Array(e.exports.memory.buffer);d.set(i,c);let f=t(u,a,n,c,i.length);if(0===f&&o&&o(u,l,n),r.set(d.subarray(u,u+a*n)),s(u-s(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:i,supported:!0,decodeVertexBuffer(t,r,a,n,i){o(e.exports.meshopt_decodeVertexBuffer,t,r,a,n,e.exports[s[i]])},decodeIndexBuffer(t,r,a,n){o(e.exports.meshopt_decodeIndexBuffer,t,r,a,n)},decodeIndexSequence(t,r,a,n){o(e.exports.meshopt_decodeIndexSequence,t,r,a,n)},decodeGltfBuffer(t,r,a,n,i,u){o(e.exports[l[i]],t,r,a,n,e.exports[s[u]])}}})())}}let e2=(e,t,r,a)=>(0,eX.useLoader)(er,e,e1(t,r,a));e2.preload=(e,t,r,a)=>eX.useLoader.preload(er,e,e1(t,r,a)),e2.clear=e=>eX.useLoader.clear(er,e),e2.setDecoderPath=e=>{e0=e};var e3=e.i(89887);let e9=` +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); +} +`;function e5({materialName:e,material:t,lightMap:r}){let a=(0,E.useDebug)(),i=a?.debugMode??!1,s=(0,y.textureToUrl)(e),l=(0,B.useTexture)(s,e=>(0,C.setupTexture)(e)),c=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),f=(0,o.useCallback)(e=>{let t;(0,M.injectCustomFog)(e,D.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new u.Vector3(0,.4,1):new u.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include +${e9} +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]),h=(0,o.useRef)(null),m=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=h.current??m.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let p={DEBUG_MODE:+!!i},g=`${d}`;return c?(0,n.jsx)("meshBasicMaterial",{ref:h,map:l,toneMapped:!1,defines:p,onBeforeCompile:f},g):(0,n.jsx)("meshLambertMaterial",{ref:m,map:l,lightMap:r,toneMapped:!1,defines:p,onBeforeCompile:f},g)}function e8(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=u.SRGBColorSpace),t??null}function e4(e){let t,r,a,s=(0,i.c)(13),{node:l}=e;e:{let e,r;if(!l.material){let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],s[0]=e):e=s[0],t=e;break e}if(Array.isArray(l.material)){let e;s[1]!==l.material?(e=l.material.map(e6),s[1]=l.material,s[2]=e):e=s[2],t=e;break e}s[3]!==l.material?(e=e8(l.material),s[3]=l.material,s[4]=e):e=s[4],s[5]!==e?(r=[e],s[5]=e,s[6]=r):r=s[6],t=r}let u=t;return s[7]!==u||s[8]!==l.material?(r=l.material?(0,n.jsx)(o.Suspense,{fallback:(0,n.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,t)=>(0,n.jsx)(e5,{materialName:e.userData.resource_path,material:e,lightMap:u[t]},t)):(0,n.jsx)(e5,{materialName:l.material.userData.resource_path,material:l.material,lightMap:u[0]})}):null,s[7]=u,s[8]=l.material,s[9]=r):r=s[9],s[10]!==l.geometry||s[11]!==r?(a=(0,n.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:r}),s[10]=l.geometry,s[11]=r,s[12]=a):a=s[12],a}function e6(e){return e8(e)}let e7=(0,o.memo)(function(e){let t,r,a,o,s,l,u=(0,i.c)(10),{object:c,interiorFile:d}=e,{nodes:f}=((l=(0,i.c)(2))[0]!==d?(s=(0,y.interiorToUrl)(d),l[0]=d,l[1]=s):s=l[1],e2(s)),h=(0,E.useDebug)(),m=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?(r=Object.entries(f).filter(ta).map(tn),u[1]=f,u[2]=r):r=u[2],u[3]!==m||u[4]!==d||u[5]!==c?(a=m?(0,n.jsxs)(e3.FloatingLabel,{children:[c._id,": ",d]}):null,u[3]=m,u[4]=d,u[5]=c,u[6]=a):a=u[6],u[7]!==r||u[8]!==a?(o=(0,n.jsxs)("group",{rotation:t,children:[r,a]}),u[7]=r,u[8]=a,u[9]=o):o=u[9],o});function te(e){let t,r,a,o,s=(0,i.c)(9),{color:l,label:u}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("boxGeometry",{args:[10,10,10]}),s[0]=t):t=s[0],s[1]!==l?(r=(0,n.jsx)("meshStandardMaterial",{color:l,wireframe:!0}),s[1]=l,s[2]=r):r=s[2],s[3]!==l||s[4]!==u?(a=u?(0,n.jsx)(e3.FloatingLabel,{color:l,children:u}):null,s[3]=l,s[4]=u,s[5]=a):a=s[5],s[6]!==r||s[7]!==a?(o=(0,n.jsxs)("mesh",{children:[t,r,a]}),s[6]=r,s[7]=a,s[8]=o):o=s[8],o}function tt(e){let t,r=(0,i.c)(3),{label:a}=e,o=(0,E.useDebug)(),s=o?.debugMode??!1;return r[0]!==s||r[1]!==a?(t=s?(0,n.jsx)(te,{color:"red",label:a}):null,r[0]=s,r[1]=a,r[2]=t):t=r[2],t}let tr=(0,o.memo)(function(e){let t,r,a,s,l,u,c,d,f,h=(0,i.c)(22),{object:m}=e;h[0]!==m?(t=(0,b.getProperty)(m,"interiorFile"),h[0]=m,h[1]=t):t=h[1];let p=t;h[2]!==m?(r=(0,b.getPosition)(m),h[2]=m,h[3]=r):r=h[3];let g=r;h[4]!==m?(a=(0,b.getScale)(m),h[4]=m,h[5]=a):a=h[5];let v=a;h[6]!==m?(s=(0,b.getRotation)(m),h[6]=m,h[7]=s):s=h[7];let y=s,A=`${m._id}: ${p}`;return h[8]!==A?(l=(0,n.jsx)(tt,{label:A}),h[8]=A,h[9]=l):l=h[9],h[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,n.jsx)(te,{color:"orange"}),h[10]=u):u=h[10],h[11]!==p||h[12]!==m?(c=(0,n.jsx)(o.Suspense,{fallback:u,children:(0,n.jsx)(e7,{object:m,interiorFile:p})}),h[11]=p,h[12]=m,h[13]=c):c=h[13],h[14]!==l||h[15]!==c?(d=(0,n.jsx)(Q,{fallback:l,children:c}),h[14]=l,h[15]=c,h[16]=d):d=h[16],h[17]!==g||h[18]!==y||h[19]!==v||h[20]!==d?(f=(0,n.jsx)("group",{position:g,quaternion:y,scale:v,children:d}),h[17]=g,h[18]=y,h[19]=v,h[20]=d,h[21]=f):f=h[21],f});function ta(e){let[,t]=e;return t.isMesh}function tn(e){let[t,r]=e;return(0,n.jsx)(e4,{node:r},t)}function ti(e,{path:t}){let[r]=(0,eX.useLoader)(u.CubeTextureLoader,[e],e=>e.setPath(t));return r}ti.preload=(e,{path:t})=>eX.useLoader.preload(u.CubeTextureLoader,[e],e=>e.setPath(t));let to=()=>{};function ts(e){return e.wrapS=u.RepeatWrapping,e.wrapT=u.RepeatWrapping,e.minFilter=u.LinearFilter,e.magFilter=u.LinearFilter,e.colorSpace=u.NoColorSpace,e.needsUpdate=!0,e}let tl=` + 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; + } +`,tu=` + 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 tc({textureUrl:e,radius:t,heightPercent:r,speed:a,windDirection:i,layerIndex:s}){let{debugMode:l}=(0,E.useDebug)(),{animationEnabled:c}=(0,E.useSettings)(),d=(0,o.useRef)(null),f=(0,B.useTexture)(e,ts),h=(0,o.useMemo)(()=>{let e=r-.05;return function(e,t,r,a){var n;let i,o,s,l,c,d,f,h,m,p,g,v,y,A,F,b,C,B=new u.BufferGeometry,S=new Float32Array(75),x=new Float32Array(50),E=[.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 a=5*t+r,n=-e+r*M,i=e-t*M,o=e*E[a];S[3*a]=n,S[3*a+1]=o,S[3*a+2]=i,x[2*a]=r,x[2*a+1]=t}n=S,i=e=>({x:n[3*e],y:n[3*e+1],z:n[3*e+2]}),o=(e,t,r,a)=>{n[3*e]=t,n[3*e+1]=r,n[3*e+2]=a},s=i(1),l=i(3),c=i(5),d=i(6),f=i(8),h=i(9),m=i(15),p=i(16),g=i(18),v=i(19),y=i(21),A=i(23),F=c.x+(s.x-c.x)*.5,b=c.y+(s.y-c.y)*.5,C=c.z+(s.z-c.z)*.5,o(0,d.x+(F-d.x)*2,d.y+(b-d.y)*2,d.z+(C-d.z)*2),F=h.x+(l.x-h.x)*.5,b=h.y+(l.y-h.y)*.5,C=h.z+(l.z-h.z)*.5,o(4,f.x+(F-f.x)*2,f.y+(b-f.y)*2,f.z+(C-f.z)*2),F=y.x+(m.x-y.x)*.5,b=y.y+(m.y-y.y)*.5,C=y.z+(m.z-y.z)*.5,o(20,p.x+(F-p.x)*2,p.y+(b-p.y)*2,p.z+(C-p.z)*2),F=A.x+(v.x-A.x)*.5,b=A.y+(v.y-A.y)*.5,C=A.z+(v.z-A.z)*.5,o(24,g.x+(F-g.x)*2,g.y+(b-g.y)*2,g.z+(C-g.z)*2);let D=function(e,t){let r=new Float32Array(25);for(let a=0;a<25;a++){let n=e[3*a],i=e[3*a+2],o=1.3-Math.sqrt(n*n+i*i)/t;o<.4?o=0:o>.8&&(o=1),r[a]=o}return r}(S,e),k=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,a=r+1,n=r+5,i=n+1;k.push(r,n,i),k.push(r,i,a)}return B.setIndex(k),B.setAttribute("position",new u.Float32BufferAttribute(S,3)),B.setAttribute("uv",new u.Float32BufferAttribute(x,2)),B.setAttribute("alpha",new u.Float32BufferAttribute(D,1)),B.computeBoundingSphere(),B}(t,r,e,0)},[t,r]);(0,o.useEffect)(()=>()=>{h.dispose()},[h]);let m=(0,o.useMemo)(()=>new u.ShaderMaterial({uniforms:{cloudTexture:{value:f},uvOffset:{value:new u.Vector2(0,0)},debugMode:{value:+!!l},layerIndex:{value:s}},vertexShader:tl,fragmentShader:tu,transparent:!0,depthWrite:!1,side:u.DoubleSide}),[f,l,s]);return(0,o.useEffect)(()=>()=>{m.dispose()},[m]),(0,A.useFrame)(c?(e,t)=>{let r=1e3*t/32;d.current??=new u.Vector2(0,0),d.current.x+=i.x*a*r,d.current.y+=i.y*a*r,d.current.x-=Math.floor(d.current.x),d.current.y-=Math.floor(d.current.y),m.uniforms.uvOffset.value.copy(d.current)}:to),(0,n.jsx)("mesh",{geometry:h,frustumCulled:!1,renderOrder:10,children:(0,n.jsx)("primitive",{object:m,attach:"material"})})}function td(e){var t;let r,a,s,l,c,d,f,h,m,p,v,F,C,B,S,x,E,M,D,k=(0,i.c)(37),{object:w}=e;k[0]!==w?(r=(0,b.getProperty)(w,"materialList"),k[0]=w,k[1]=r):r=k[1];let{data:I}=(t=r,(M=(0,i.c)(7))[0]!==t?(S=["detailMapList",t],x=()=>(0,y.loadDetailMapList)(t),M[0]=t,M[1]=S,M[2]=x):(S=M[1],x=M[2]),D=!!t,M[3]!==S||M[4]!==x||M[5]!==D?(E={queryKey:S,queryFn:x,enabled:D},M[3]=S,M[4]=x,M[5]=D,M[6]=E):E=M[6],(0,g.useQuery)(E));k[2]!==w?(a=(0,b.getFloat)(w,"visibleDistance")??500,k[2]=w,k[3]=a):a=k[3];let T=.95*a;k[4]!==w?(s=(0,b.getFloat)(w,"cloudSpeed1")??1e-4,k[4]=w,k[5]=s):s=k[5],k[6]!==w?(l=(0,b.getFloat)(w,"cloudSpeed2")??2e-4,k[6]=w,k[7]=l):l=k[7],k[8]!==w?(c=(0,b.getFloat)(w,"cloudSpeed3")??3e-4,k[8]=w,k[9]=c):c=k[9],k[10]!==s||k[11]!==l||k[12]!==c?(d=[s,l,c],k[10]=s,k[11]=l,k[12]=c,k[13]=d):d=k[13];let R=d;k[14]!==w?(f=(0,b.getFloat)(w,"cloudHeightPer1")??.35,k[14]=w,k[15]=f):f=k[15],k[16]!==w?(h=(0,b.getFloat)(w,"cloudHeightPer2")??.25,k[16]=w,k[17]=h):h=k[17],k[18]!==w?(m=(0,b.getFloat)(w,"cloudHeightPer3")??.2,k[18]=w,k[19]=m):m=k[19],k[20]!==f||k[21]!==h||k[22]!==m?(p=[f,h,m],k[20]=f,k[21]=h,k[22]=m,k[23]=p):p=k[23];let P=p;if(k[24]!==w){e:{let e,t=(0,b.getProperty)(w,"windVelocity");if(t){let[e,r]=t.split(" ").map(tf);if(0!==e||0!==r){v=new u.Vector2(r,-e).normalize();break e}}k[26]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector2(1,0),k[26]=e):e=k[26],v=e}k[24]=w,k[25]=v}else v=k[25];let G=v;t:{let e;if(!I){let e;k[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],k[27]=e):e=k[27],F=e;break t}if(k[28]!==P||k[29]!==R||k[30]!==I){e=[];for(let t=0;t<3;t++){let r=I[7+t];r&&e.push({texture:r,height:P[t],speed:R[t]})}k[28]=P,k[29]=R,k[30]=I,k[31]=e}else e=k[31];F=e}let L=F,j=(0,o.useRef)(null);return(k[32]===Symbol.for("react.memo_cache_sentinel")?(C=e=>{let{camera:t}=e;j.current&&j.current.position.copy(t.position)},k[32]=C):C=k[32],(0,A.useFrame)(C),L&&0!==L.length)?(k[33]!==L||k[34]!==T||k[35]!==G?(B=(0,n.jsx)("group",{ref:j,children:L.map((e,t)=>{let r=(0,y.textureToUrl)(e.texture);return(0,n.jsx)(o.Suspense,{fallback:null,children:(0,n.jsx)(tc,{textureUrl:r,radius:T,heightPercent:e.height,speed:e.speed,windDirection:G,layerIndex:t})},t)})}),k[33]=L,k[34]=T,k[35]=G,k[36]=B):B=k[36],B):null}function tf(e){return parseFloat(e)}let th=!1;function tm(e){if(!e)return;let[t,r,a]=e.split(" ").map(e=>parseFloat(e));return[new u.Color().setRGB(t,r,a),new u.Color().setRGB(t,r,a).convertSRGBToLinear()]}function tp({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:a}=(0,F.useThree)(),i=ti(e,{path:""}),s=!!t,l=(0,o.useMemo)(()=>a.projectionMatrixInverse,[a]),c=(0,o.useMemo)(()=>r?(0,D.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),d=(0,o.useRef)({skybox:{value:i},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:s},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:a.matrixWorld},cameraHeight:D.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),f=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,o.useEffect)(()=>{d.current.skybox.value=i,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=s,d.current.fogVolumeData.value=c,d.current.horizonFogHeight.value=f},[i,t,s,c,f]),(0,n.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,n.jsxs)("bufferGeometry",{children:[(0,n.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,n.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,n.jsx)("shaderMaterial",{uniforms:d.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 tg(e){let t,r,a,o,s=(0,i.c)(6),{materialList:l,fogColor:u,fogState:c}=e,{data:d}=((o=(0,i.c)(2))[0]!==l?(a={queryKey:["detailMapList",l],queryFn:()=>(0,y.loadDetailMapList)(l)},o[0]=l,o[1]=a):a=o[1],(0,g.useQuery)(a));s[0]!==d?(t=d?[(0,y.textureToUrl)(d[1]),(0,y.textureToUrl)(d[3]),(0,y.textureToUrl)(d[4]),(0,y.textureToUrl)(d[5]),(0,y.textureToUrl)(d[0]),(0,y.textureToUrl)(d[2])]:null,s[0]=d,s[1]=t):t=s[1];let f=t;return f?(s[2]!==u||s[3]!==c||s[4]!==f?(r=(0,n.jsx)(tp,{skyBoxFiles:f,fogColor:u,fogState:c}),s[2]=u,s[3]=c,s[4]=f,s[5]=r):r=s[5],r):null}function tv({skyColor:e,fogColor:t,fogState:r}){let{camera:a}=(0,F.useThree)(),i=!!t,s=(0,o.useMemo)(()=>a.projectionMatrixInverse,[a]),l=(0,o.useMemo)(()=>r?(0,D.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),c=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),d=(0,o.useRef)({skyColor:{value:e},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:a.matrixWorld},cameraHeight:D.globalFogUniforms.cameraHeight,fogVolumeData:{value:l},horizonFogHeight:{value:c}});return(0,o.useEffect)(()=>{d.current.skyColor.value=e,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=i,d.current.fogVolumeData.value=l,d.current.horizonFogHeight.value=c},[e,t,i,l,c]),(0,n.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,n.jsxs)("bufferGeometry",{children:[(0,n.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,n.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,n.jsx)("shaderMaterial",{uniforms:d.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 ty(e,t){let{fogDistance:r,visibleDistance:a}=e;return[r,a]}function tA({fogState:e,enabled:t}){let{scene:r,camera:a}=(0,F.useThree)(),n=(0,o.useRef)(null),i=(0,o.useMemo)(()=>(0,D.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,o.useEffect)(()=>{th||((0,M.installCustomFogShader)(),th=!0)},[]),(0,o.useEffect)(()=>{(0,D.resetGlobalFogUniforms)();let[t,o]=ty(e,a.position.y),s=new u.Fog(e.fogColor,t,o);return r.fog=s,n.current=s,(0,D.updateGlobalFogUniforms)(a.position.y,i),()=>{r.fog=null,n.current=null,(0,D.resetGlobalFogUniforms)()}},[r,a,e,i]),(0,o.useEffect)(()=>{let r=n.current;if(r)if(t){let[t,n]=ty(e,a.position.y);r.near=t,r.far=n}else r.near=1e10,r.far=1e10},[t,e,a.position.y]),(0,A.useFrame)(()=>{let r=n.current;if(!r)return;let o=a.position.y;if((0,D.updateGlobalFogUniforms)(o,i,t),t){let[t,a]=ty(e,o);r.near=t,r.far=a,r.color.copy(e.fogColor)}}),null}function tF(e){return parseFloat(e)}function tb(e){return parseFloat(e)}function tC(e){return parseFloat(e)}function tB(e){let t=new Set;return e.bones.forEach((e,r)=>{e.name.match(/^Hulk/i)&&t.add(r)}),t}function tS(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,a=e.attributes.skinWeight,n=e.index,i=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(o)){i[e]=!0;break}}if(n){let t=[],r=n.array;for(let e=0;e{for(r.current+=n;r.current>=.03125;)if(r.current-=.03125,a.current++,t.current)for(let e of t.current)e(a.current)});let i=(0,o.useCallback)(e=>(t.current??=new Set,t.current.add(e),()=>{t.current.delete(e)}),[]),s=(0,o.useCallback)(()=>a.current,[]),l=(0,o.useMemo)(()=>({subscribe:i,getTick:s}),[i,s]);return(0,n.jsx)(tR.Provider,{value:l,children:e})}let tG=new Map;function tL(e){e.onBeforeCompile=t=>{(0,M.injectCustomFog)(t,D.globalFogUniforms),e instanceof u.MeshLambertMaterial&&(t.uniforms.shapeDirectionalFactor={value:1},t.uniforms.shapeAmbientFactor={value:1.5},t.fragmentShader=t.fragmentShader.replace("#include ",`#include +uniform float shapeDirectionalFactor; +uniform float shapeAmbientFactor; +`),t.fragmentShader=t.fragmentShader.replace("#include ",`#include + // Apply shape-specific lighting multipliers + reflectedLight.directDiffuse *= shapeDirectionalFactor; + reflectedLight.indirectDiffuse *= shapeAmbientFactor; +`))}}function tj(e,t,r,a,n=1,i=!1){let o=r.has("Translucent"),s=r.has("Additive"),l=r.has("SelfIlluminating"),c=n<1||i;if(l){let e=s||o||c,r=new u.MeshBasicMaterial({map:t,side:2,transparent:e,depthWrite:!e,alphaTest:0,fog:!0,...c&&{opacity:n},...s&&{blending:u.AdditiveBlending}});return tL(r),r}if(a||o){let e={map:t,transparent:c,alphaTest:.5*!c,...c&&{opacity:n,depthWrite:!1},reflectivity:0},r=new u.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),a=new u.MeshLambertMaterial({...e,side:0});return tL(r),tL(a),[r,a]}let d=new u.MeshLambertMaterial({map:t,side:2,reflectivity:0,...c&&{transparent:!0,opacity:n,depthWrite:!1}});return tL(d),d}function t_(e){let t,r=(0,i.c)(2);return r[0]!==e?(t=(0,y.shapeToUrl)(e),r[0]=e,r[1]=t):t=r[1],e2(t)}let tO=(0,o.memo)(function(e){let t,r,a,s,l,c,d=(0,i.c)(37),{material:f,shapeName:h,geometry:m,backGeometry:p,castShadow:g,receiveShadow:v,vis:A,animated:F}=e,b=void 0!==g&&g,C=void 0!==v&&v,S=void 0===A?1:A,x=void 0!==F&&F,M=f.userData.resource_path;d[0]!==f.userData.flag_names?(t=f.userData.flag_names??[],d[0]=f.userData.flag_names,d[1]=t):t=d[1],d[2]!==t?(r=new Set(t),d[2]=t,d[3]=r):r=d[3];let D=r,k=function(e){let t,r,a,n,s=(0,i.c)(14),{animationEnabled:l}=(0,E.useSettings)();s[0]!==e?(t={queryKey:["ifl",e],queryFn:()=>(0,y.loadImageFrameList)(e)},s[0]=e,s[1]=t):t=s[1];let{data:c}=(m=t,(0,tI.useBaseQuery)({...m,enabled:!0,suspense:!0,throwOnError:tT.defaultThrowOnError,placeholderData:void 0},tw.QueryObserver,void 0));if(s[2]!==c||s[3]!==e){let t;s[5]!==e?(t=t=>(0,y.iflTextureToUrl)(t.name,e),s[5]=e,s[6]=t):t=s[6],r=c.map(t),s[2]=c,s[3]=e,s[4]=r}else r=s[4];let d=r,f=(0,B.useTexture)(d);if(s[7]!==c||s[8]!==e||s[9]!==f){let t;if(!(a=tG.get(e))){let t,r,n,i,o,s,l,c,d;r=(t=f[0].image).width,n=t.height,o=Math.ceil(Math.sqrt(i=f.length)),s=Math.ceil(i/o),(l=document.createElement("canvas")).width=r*o,l.height=n*s,c=l.getContext("2d"),f.forEach((e,t)=>{let a=Math.floor(t/o);c.drawImage(e.image,t%o*r,a*n)}),(d=new u.CanvasTexture(l)).colorSpace=u.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=u.NearestFilter,d.magFilter=u.NearestFilter,d.wrapS=u.ClampToEdgeWrapping,d.wrapT=u.ClampToEdgeWrapping,d.repeat.set(1/o,1/s),a={texture:d,columns:o,rows:s,frameCount:i,frameStartTicks:[],totalTicks:0,lastFrame:-1},tG.set(e,a)}t=0,(p=a).frameStartTicks=c.map(e=>{let r=t;return t+=e.frameCount,r}),p.totalTicks=t,s[7]=c,s[8]=e,s[9]=f,s[10]=a}else a=s[10];let h=a;s[11]!==l||s[12]!==h?(n=e=>{let t=l?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:a}=e;for(let e=a.length-1;e>=0;e--)if(r>=a[e])return e;return 0}(h,e):0;!function(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,a=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,a/e.rows)}(h,t)},s[11]=l,s[12]=h,s[13]=n):n=s[13];var m,p,g=n;let v=(0,o.useContext)(tR);if(!v)throw Error("useTick must be used within a TickProvider");let A=(0,o.useRef)(g);return A.current=g,(0,o.useEffect)(()=>v.subscribe(e=>A.current(e)),[v]),h.texture}(`textures/${M}.ifl`);d[4]!==h?(a=h&&tE(h),d[4]=h,d[5]=a):a=d[5];let w=a;d[6]!==x||d[7]!==D||d[8]!==w||d[9]!==f||d[10]!==k||d[11]!==S?(s=tj(f,k,D,w,S,x),d[6]=x,d[7]=D,d[8]=w,d[9]=f,d[10]=k,d[11]=S,d[12]=s):s=d[12];let I=s;if(Array.isArray(I)){let e,t,r,a,i,o=p||m;return d[13]!==I[0]?(e=(0,n.jsx)("primitive",{object:I[0],attach:"material"}),d[13]=I[0],d[14]=e):e=d[14],d[15]!==b||d[16]!==C||d[17]!==e||d[18]!==o?(t=(0,n.jsx)("mesh",{geometry:o,castShadow:b,receiveShadow:C,children:e}),d[15]=b,d[16]=C,d[17]=e,d[18]=o,d[19]=t):t=d[19],d[20]!==I[1]?(r=(0,n.jsx)("primitive",{object:I[1],attach:"material"}),d[20]=I[1],d[21]=r):r=d[21],d[22]!==b||d[23]!==m||d[24]!==C||d[25]!==r?(a=(0,n.jsx)("mesh",{geometry:m,castShadow:b,receiveShadow:C,children:r}),d[22]=b,d[23]=m,d[24]=C,d[25]=r,d[26]=a):a=d[26],d[27]!==t||d[28]!==a?(i=(0,n.jsxs)(n.Fragment,{children:[t,a]}),d[27]=t,d[28]=a,d[29]=i):i=d[29],i}return d[30]!==I?(l=(0,n.jsx)("primitive",{object:I,attach:"material"}),d[30]=I,d[31]=l):l=d[31],d[32]!==b||d[33]!==m||d[34]!==C||d[35]!==l?(c=(0,n.jsx)("mesh",{geometry:m,castShadow:b,receiveShadow:C,children:l}),d[32]=b,d[33]=m,d[34]=C,d[35]=l,d[36]=c):c=d[36],c}),tU=(0,o.memo)(function(e){let t,r,a,o,s,l,u,c,d=(0,i.c)(42),{material:f,shapeName:h,geometry:m,backGeometry:p,castShadow:g,receiveShadow:v,vis:A,animated:F}=e,b=void 0!==g&&g,S=void 0!==v&&v,x=void 0===A?1:A,E=void 0!==F&&F,M=f.userData.resource_path;d[0]!==f.userData.flag_names?(t=f.userData.flag_names??[],d[0]=f.userData.flag_names,d[1]=t):t=d[1],d[2]!==t?(r=new Set(t),d[2]=t,d[3]=r):r=d[3];let D=r;M||console.warn(`No resource_path was found on "${h}" - rendering fallback.`),d[4]!==M?(a=M?(0,y.textureToUrl)(M):y.FALLBACK_TEXTURE_URL,d[4]=M,d[5]=a):a=d[5];let k=a;d[6]!==h?(o=h&&tE(h),d[6]=h,d[7]=o):o=d[7];let w=o,I=D.has("Translucent");d[8]!==w||d[9]!==I?(s=e=>w||I?(0,C.setupTexture)(e,{disableMipmaps:!0}):(0,C.setupTexture)(e),d[8]=w,d[9]=I,d[10]=s):s=d[10];let T=(0,B.useTexture)(k,s);d[11]!==E||d[12]!==D||d[13]!==w||d[14]!==f||d[15]!==T||d[16]!==x?(l=tj(f,T,D,w,x,E),d[11]=E,d[12]=D,d[13]=w,d[14]=f,d[15]=T,d[16]=x,d[17]=l):l=d[17];let R=l;if(Array.isArray(R)){let e,t,r,a,i,o=p||m;return d[18]!==R[0]?(e=(0,n.jsx)("primitive",{object:R[0],attach:"material"}),d[18]=R[0],d[19]=e):e=d[19],d[20]!==b||d[21]!==S||d[22]!==o||d[23]!==e?(t=(0,n.jsx)("mesh",{geometry:o,castShadow:b,receiveShadow:S,children:e}),d[20]=b,d[21]=S,d[22]=o,d[23]=e,d[24]=t):t=d[24],d[25]!==R[1]?(r=(0,n.jsx)("primitive",{object:R[1],attach:"material"}),d[25]=R[1],d[26]=r):r=d[26],d[27]!==b||d[28]!==m||d[29]!==S||d[30]!==r?(a=(0,n.jsx)("mesh",{geometry:m,castShadow:b,receiveShadow:S,children:r}),d[27]=b,d[28]=m,d[29]=S,d[30]=r,d[31]=a):a=d[31],d[32]!==t||d[33]!==a?(i=(0,n.jsxs)(n.Fragment,{children:[t,a]}),d[32]=t,d[33]=a,d[34]=i):i=d[34],i}return d[35]!==R?(u=(0,n.jsx)("primitive",{object:R,attach:"material"}),d[35]=R,d[36]=u):u=d[36],d[37]!==b||d[38]!==m||d[39]!==S||d[40]!==u?(c=(0,n.jsx)("mesh",{geometry:m,castShadow:b,receiveShadow:S,children:u}),d[37]=b,d[38]=m,d[39]=S,d[40]=u,d[41]=c):c=d[41],c}),tH=(0,o.memo)(function(e){let t=(0,i.c)(18),{material:r,shapeName:a,geometry:o,backGeometry:s,castShadow:l,receiveShadow:u,vis:c,animated:d}=e,f=void 0!==l&&l,h=void 0!==u&&u,m=void 0===c?1:c,p=void 0!==d&&d,g=new Set(r.userData.flag_names??[]).has("IflMaterial"),v=r.userData.resource_path;if(g&&v){let e;return t[0]!==p||t[1]!==s||t[2]!==f||t[3]!==o||t[4]!==r||t[5]!==h||t[6]!==a||t[7]!==m?(e=(0,n.jsx)(tO,{material:r,shapeName:a,geometry:o,backGeometry:s,castShadow:f,receiveShadow:h,vis:m,animated:p}),t[0]=p,t[1]=s,t[2]=f,t[3]=o,t[4]=r,t[5]=h,t[6]=a,t[7]=m,t[8]=e):e=t[8],e}if(!r.name)return null;{let e;return t[9]!==p||t[10]!==s||t[11]!==f||t[12]!==o||t[13]!==r||t[14]!==h||t[15]!==a||t[16]!==m?(e=(0,n.jsx)(tU,{material:r,shapeName:a,geometry:o,backGeometry:s,castShadow:f,receiveShadow:h,vis:m,animated:p}),t[9]=p,t[10]=s,t[11]=f,t[12]=o,t[13]=r,t[14]=h,t[15]=a,t[16]=m,t[17]=e):e=t[17],e}});function tN(e){let t,r,a,o,s=(0,i.c)(9),{color:l,label:u}=e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("boxGeometry",{args:[10,10,10]}),s[0]=t):t=s[0],s[1]!==l?(r=(0,n.jsx)("meshStandardMaterial",{color:l,wireframe:!0}),s[1]=l,s[2]=r):r=s[2],s[3]!==l||s[4]!==u?(a=u?(0,n.jsx)(e3.FloatingLabel,{color:l,children:u}):null,s[3]=l,s[4]=u,s[5]=a):a=s[5],s[6]!==r||s[7]!==a?(o=(0,n.jsxs)("mesh",{children:[t,r,a]}),s[6]=r,s[7]=a,s[8]=o):o=s[8],o}function tJ(e){let t,r=(0,i.c)(4),{color:a,label:o}=e,{debugMode:s}=(0,E.useDebug)();return r[0]!==a||r[1]!==s||r[2]!==o?(t=s?(0,n.jsx)(tN,{color:a,label:o}):null,r[0]=a,r[1]=s,r[2]=o,r[3]=t):t=r[3],t}let tK=new Set(["octahedron.dts"]);function tV(e){let t,r,a,o,s=(0,i.c)(6),{label:l}=e,{debugMode:u}=(0,E.useDebug)();return u?(s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("icosahedronGeometry",{args:[1,1]}),r=(0,n.jsx)("meshBasicMaterial",{color:"cyan",wireframe:!0}),s[0]=t,s[1]=r):(t=s[0],r=s[1]),s[2]!==l?(a=l?(0,n.jsx)(e3.FloatingLabel,{color:"cyan",children:l}):null,s[2]=l,s[3]=a):a=s[3],s[4]!==a?(o=(0,n.jsxs)("mesh",{children:[t,r,a]}),s[4]=a,s[5]=o):o=s[5],o):null}function tz(e){let t,r,a,s,l,u=(0,i.c)(15),{loadingColor:c,children:d}=e,f=void 0===c?"yellow":c,{object:h,shapeName:m}=tD();if(!m){let e,t=`${h._id}: `;return u[0]!==t?(e=(0,n.jsx)(tJ,{color:"orange",label:t}),u[0]=t,u[1]=e):e=u[1],e}if(tK.has(m.toLowerCase())){let e,t=`${h._id}: ${m}`;return u[2]!==t?(e=(0,n.jsx)(tV,{label:t}),u[2]=t,u[3]=e):e=u[3],e}let p=`${h._id}: ${m}`;return u[4]!==p?(t=(0,n.jsx)(tJ,{color:"red",label:p}),u[4]=p,u[5]=t):t=u[5],u[6]!==f?(r=(0,n.jsx)(tN,{color:f}),u[6]=f,u[7]=r):r=u[7],u[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)(tW,{}),u[8]=a):a=u[8],u[9]!==d||u[10]!==r?(s=(0,n.jsxs)(o.Suspense,{fallback:r,children:[a,d]}),u[9]=d,u[10]=r,u[11]=s):s=u[11],u[12]!==t||u[13]!==s?(l=(0,n.jsx)(Q,{fallback:t,children:s}),u[12]=t,u[13]=s,u[14]=l):l=u[14],l}function tq(e){return null!=e&&"ambient"===(e.vis_sequence??"").toLowerCase()&&Array.isArray(e.vis_keyframes)&&e.vis_keyframes.length>1&&(e.vis_duration??0)>0}function tQ(e){let t,r,a=(0,i.c)(7),{keyframes:s,duration:l,cyclic:u,children:c}=e,d=(0,o.useRef)(null),{animationEnabled:f}=(0,E.useSettings)();return a[0]!==f||a[1]!==u||a[2]!==l||a[3]!==s?(t=()=>{let e=d.current;if(!e)return;if(!f)return void e.traverse(e=>{if(e.isMesh){let t=e.material;t&&!Array.isArray(t)&&(t.opacity=s[0])}});let t=performance.now()/1e3,r=u?t%l/l:Math.min(t/l,1),a=s.length,n=r*a,i=Math.floor(n)%a,o=n-Math.floor(n),c=s[i]+(s[(i+1)%a]-s[i])*o;e.traverse(e=>{if(e.isMesh){let t=e.material;t&&!Array.isArray(t)&&(t.opacity=c)}})},a[0]=f,a[1]=u,a[2]=l,a[3]=s,a[4]=t):t=a[4],(0,A.useFrame)(t),a[5]!==c?(r=(0,n.jsx)("group",{ref:d,children:c}),a[5]=c,a[6]=r):r=a[6],r}let tW=(0,o.memo)(function(){let e,t,r,a,s,l,u=(0,i.c)(19),{object:c,shapeName:d,isOrganic:f}=tD(),{debugMode:h}=(0,E.useDebug)(),{nodes:m}=t_(d);if(u[0]!==m){e:{let t,r=Object.values(m).filter(tX);if(r.length>0){e=tB(r[0].skeleton);break e}u[2]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,u[2]=t):t=u[2],e=t}u[0]=m,u[1]=e}else e=u[1];let p=e;u[3]!==p||u[4]!==f||u[5]!==m?(t=Object.entries(m).filter(tY).map(e=>{let[,t]=e,r=tS(t.geometry,p),a=null;if(r){(r=r.clone()).computeVertexNormals();let e=r.attributes.position,t=r.attributes.normal,n=e.array,i=t.array,o=new Map;for(let t=0;t1){let t=0,r=0,a=0;for(let n of e)t+=i[3*n],r+=i[3*n+1],a+=i[3*n+2];let n=Math.sqrt(t*t+r*r+a*a);for(let o of(n>0&&(t/=n,r/=n,a/=n),e))i[3*o]=t,i[3*o+1]=r,i[3*o+2]=a}if(t.needsUpdate=!0,f){let e=(a=r.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:t,geometry:r,backGeometry:a,vis:i,visAnim:s}=e,l=!!s,u=(0,n.jsx)("mesh",{geometry:r,children:(0,n.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),c=t.material?Array.isArray(t.material)?t.material.map((e,t)=>(0,n.jsx)(tH,{material:e,shapeName:d,geometry:r,backGeometry:a,castShadow:v,receiveShadow:v,vis:i,animated:l},t)):(0,n.jsx)(tH,{material:t.material,shapeName:d,geometry:r,backGeometry:a,castShadow:v,receiveShadow:v,vis:i,animated:l}):null;return s?(0,n.jsx)(tQ,{keyframes:s.keyframes,duration:s.duration,cyclic:s.cyclic,children:(0,n.jsx)(o.Suspense,{fallback:u,children:c})},t.id):(0,n.jsx)(o.Suspense,{fallback:u,children:c},t.id)}),u[8]=v,u[9]=g,u[10]=d,u[11]=a):a=u[11],u[12]!==h||u[13]!==c||u[14]!==d?(s=h?(0,n.jsxs)(e3.FloatingLabel,{children:[c._id,": ",d]}):null,u[12]=h,u[13]=c,u[14]=d,u[15]=s):s=u[15],u[16]!==a||u[17]!==s?(l=(0,n.jsxs)("group",{rotation:r,children:[a,s]}),u[16]=a,u[17]=s,u[18]=l):l=u[18],l});function tX(e){return e.skeleton}function tY(e){let[,t]=e;return t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)&&((t.userData?.vis??1)>.01||tq(t.userData))}var tZ=e.i(6112);let t$={1:"Storm",2:"Inferno"},t0=(0,o.createContext)(null);function t1(){let e=(0,o.useContext)(t0);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function t2({children:e}){let{camera:t}=(0,F.useThree)(),[r,a]=(0,o.useState)(-1),[i,s]=(0,o.useState)({}),[l,c]=(0,o.useState)(()=>({initialized:!1,position:null,quarternion:null})),d=(0,o.useCallback)(e=>{s(t=>({...t,[e.id]:e}))},[]),f=(0,o.useCallback)(e=>{s(t=>{let{[e.id]:r,...a}=t;return a})},[]),h=Object.keys(i).length,m=(0,o.useCallback)(e=>{if(e>=0&&e{m(h?(r+1)%h:-1)},[h,r,m]);(0,o.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),a=t.split(",").map(e=>parseFloat(e)),n=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new u.Vector3(...a),quarternion:new u.Quaternion(...n)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,o.useEffect)(()=>{l.initialized&&l.position&&(t.position.copy(l.position),l.quarternion&&t.quaternion.copy(l.quarternion))},[t,l]),(0,o.useEffect)(()=>{l.initialized&&!l.position&&h>0&&-1===r&&m(0)},[h,m,r,l]);let g=(0,o.useMemo)(()=>({registerCamera:d,unregisterCamera:f,nextCamera:p,setCameraIndex:m,cameraCount:h}),[d,f,p,m,h]);return 0===h&&-1!==r&&a(-1),(0,n.jsx)(t0.Provider,{value:g,children:e})}let t3=(0,o.createContext)(null),t9=t3.Provider,t5=(0,o.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),t8={AudioEmitter:function(e){let t,r=(0,i.c)(3),{audioEnabled:a}=(0,E.useSettings)();return r[0]!==a||r[1]!==e?(t=a?(0,n.jsx)(t5,{...e}):null,r[0]=a,r[1]=e,r[2]=t):t=r[2],t},Camera:function(e){let t,r,a,n,s,l=(0,i.c)(14),{object:c}=e,{registerCamera:d,unregisterCamera:f}=t1(),h=(0,o.useId)();l[0]!==c?(t=(0,b.getProperty)(c,"dataBlock"),l[0]=c,l[1]=t):t=l[1];let m=t;l[2]!==c?(r=(0,b.getPosition)(c),l[2]=c,l[3]=r):r=l[3];let p=r;l[4]!==c?(a=(0,b.getRotation)(c),l[4]=c,l[5]=a):a=l[5];let g=a;return l[6]!==m||l[7]!==h||l[8]!==p||l[9]!==g||l[10]!==d||l[11]!==f?(n=()=>{if("Observer"===m){let e={id:h,position:new u.Vector3(...p),rotation:g};return d(e),()=>{f(e)}}},s=[h,m,d,f,p,g],l[6]=m,l[7]=h,l[8]=p,l[9]=g,l[10]=d,l[11]=f,l[12]=n,l[13]=s):(n=l[12],s=l[13]),(0,o.useEffect)(n,s),null},ForceFieldBare:(0,o.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:tr,Item:function(e){let t,r,a,s,l,u,c,d,f,h,m,p,g=(0,i.c)(32),{object:v}=e,y=J();g[0]!==v?(t=(0,b.getProperty)(v,"dataBlock")??"",g[0]=v,g[1]=t):t=g[1];let F=t,C=(0,tZ.useDatablock)(F);g[2]!==C||g[3]!==v?(r=function(e){if("string"==typeof e){let t=e.toLowerCase();return"0"!==t&&"false"!==t&&""!==t}return!!e}((0,b.getProperty)(v,"rotate")??(0,b.getProperty)(C,"rotate")),g[2]=C,g[3]=v,g[4]=r):r=g[4];let B=r;g[5]!==v?(a=(0,b.getPosition)(v),g[5]=v,g[6]=a):a=g[6];let S=a;g[7]!==v?(s=(0,b.getScale)(v),g[7]=v,g[8]=s):s=g[8];let x=s;g[9]!==v?(l=(0,b.getRotation)(v),g[9]=v,g[10]=l):l=g[10];let M=l,{animationEnabled:D}=(0,E.useSettings)(),k=(0,o.useRef)(null);g[11]!==D||g[12]!==B?(u=()=>{if(!k.current||!B||!D)return;let e=performance.now()/1e3;k.current.rotation.y=e/3*Math.PI*2},g[11]=D,g[12]=B,g[13]=u):u=g[13],(0,A.useFrame)(u),g[14]!==C?(c=(0,b.getProperty)(C,"shapeFile"),g[14]=C,g[15]=c):c=g[15];let w=c;w||console.error(` missing shape for datablock: ${F}`);let I=F?.toLowerCase()==="flag",T=y?.team??null,R=T&&T>0?t$[T]:null,P=I&&R?`${R} Flag`:null;return g[16]!==M||g[17]!==B?(d=!B&&{quaternion:M},g[16]=M,g[17]=B,g[18]=d):d=g[18],g[19]!==P?(f=P?(0,n.jsx)(e3.FloatingLabel,{opacity:.6,children:P}):null,g[19]=P,g[20]=f):f=g[20],g[21]!==f?(h=(0,n.jsx)(tz,{loadingColor:"pink",children:f}),g[21]=f,g[22]=h):h=g[22],g[23]!==S||g[24]!==x||g[25]!==h||g[26]!==d?(m=(0,n.jsx)("group",{ref:k,position:S,...d,scale:x,children:h}),g[23]=S,g[24]=x,g[25]=h,g[26]=d,g[27]=m):m=g[27],g[28]!==v||g[29]!==w||g[30]!==m?(p=(0,n.jsx)(tk,{type:"Item",object:v,shapeName:w,children:m}),g[28]=v,g[29]=w,g[30]=m,g[31]=p):p=g[31],p},SimGroup:function(e){let t,r,a,o,s=(0,i.c)(17),{object:l}=e,u=(0,R.useRuntimeObjectById)(l._id)??l,c=J();s[0]!==u._children?(t=u._children??[],s[0]=u._children,s[1]=t):t=s[1];let d=(0,R.useRuntimeChildIds)(u._id,t),f=null,h=!1;if(c&&c.hasTeams){if(h=!0,null!=c.team)f=c.team;else if(u._name){let e;if(s[2]!==u._name){let t;s[4]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,s[4]=t):t=s[4],e=u._name.match(t),s[2]=u._name,s[3]=e}else e=s[3];let t=e;t&&(f=parseInt(t[1],10))}}else if(u._name){let e;s[5]!==u._name?(e=u._name.toLowerCase(),s[5]=u._name,s[6]=e):e=s[6],h="teams"===e}s[7]!==h||s[8]!==u||s[9]!==c||s[10]!==f?(r={object:u,parent:c,hasTeams:h,team:f},s[7]=h,s[8]=u,s[9]=c,s[10]=f,s[11]=r):r=s[11];let m=r;return s[12]!==d?(a=d.map(K),s[12]=d,s[13]=a):a=s[13],s[14]!==m||s[15]!==a?(o=(0,n.jsx)(N.Provider,{value:m,children:a}),s[14]=m,s[15]=a,s[16]=o):o=s[16],o},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,E.useSettings)(),a=(0,b.getProperty)(e,"materialList"),i=(0,o.useMemo)(()=>tm((0,b.getProperty)(e,"SkySolidColor")),[e]),s=(0,b.getInt)(e,"useSkyTextures")??1,l=(0,o.useMemo)(()=>(function(e,t=!0){let r=(0,b.getFloat)(e,"fogDistance")??0,a=(0,b.getFloat)(e,"visibleDistance")??1e3,n=(0,b.getFloat)(e,"high_fogDistance"),i=(0,b.getFloat)(e,"high_visibleDistance"),o=t&&null!=n&&n>0?n:r,s=t&&null!=i&&i>0?i:a,l=function(e){if(!e)return new u.Color(.5,.5,.5);let[t,r,a]=e.split(" ").map(e=>parseFloat(e));return new u.Color().setRGB(t,r,a).convertSRGBToLinear()}((0,b.getProperty)(e,"fogColor")),c=[];for(let t=1;t<=3;t++){let r=function(e,t=1){if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[a,n,i]=r;return a<=0||i<=n?null:{visibleDistance:a,minHeight:n,maxHeight:i,percentage:Math.max(0,Math.min(1,t))}}((0,b.getProperty)(e,`fogVolume${t}`),1);r&&c.push(r)}let d=c.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:o,visibleDistance:s,fogColor:l,fogVolumes:c,fogLine:d,enabled:s>o}})(e,r),[e,r]),c=(0,o.useMemo)(()=>tm((0,b.getProperty)(e,"fogColor")),[e]),d=i||c,f=l.enabled&&t,h=l.fogColor,{scene:m,gl:p}=(0,F.useThree)();(0,o.useEffect)(()=>{if(f){let e=h.clone();m.background=e,p.setClearColor(e)}else if(d){let e=d[0].clone();m.background=e,p.setClearColor(e)}else m.background=null;return()=>{m.background=null}},[m,p,f,h,d]);let g=i?.[1];return(0,n.jsxs)(n.Fragment,{children:[a&&s?(0,n.jsx)(o.Suspense,{fallback:null,children:(0,n.jsx)(tg,{materialList:a,fogColor:f?h:void 0,fogState:f?l:void 0},a)}):g?(0,n.jsx)(tv,{skyColor:g,fogColor:f?h:void 0,fogState:f?l:void 0}):null,(0,n.jsx)(o.Suspense,{children:(0,n.jsx)(td,{object:e})}),l.enabled?(0,n.jsx)(tA,{fogState:l,enabled:t}):null]})},StaticShape:function(e){let t,r,a,o,s,l,u,c,d=(0,i.c)(19),{object:f}=e;d[0]!==f?(t=(0,b.getProperty)(f,"dataBlock")??"",d[0]=f,d[1]=t):t=d[1];let h=t,m=(0,tZ.useDatablock)(h);d[2]!==f?(r=(0,b.getPosition)(f),d[2]=f,d[3]=r):r=d[3];let p=r;d[4]!==f?(a=(0,b.getRotation)(f),d[4]=f,d[5]=a):a=d[5];let g=a;d[6]!==f?(o=(0,b.getScale)(f),d[6]=f,d[7]=o):o=d[7];let v=o;d[8]!==m?(s=(0,b.getProperty)(m,"shapeFile"),d[8]=m,d[9]=s):s=d[9];let y=s;return y||console.error(` missing shape for datablock: ${h}`),d[10]===Symbol.for("react.memo_cache_sentinel")?(l=(0,n.jsx)(tz,{}),d[10]=l):l=d[10],d[11]!==p||d[12]!==g||d[13]!==v?(u=(0,n.jsx)("group",{position:p,quaternion:g,scale:v,children:l}),d[11]=p,d[12]=g,d[13]=v,d[14]=u):u=d[14],d[15]!==f||d[16]!==y||d[17]!==u?(c=(0,n.jsx)(tk,{type:"StaticShape",object:f,shapeName:y,children:u}),d[15]=f,d[16]=y,d[17]=u,d[18]=c):c=d[18],c},Sun:function(e){let t,r,a,s,l,c,d,f,h,m,p=(0,i.c)(25),{object:g}=e;p[0]!==g?(t=((0,b.getProperty)(g,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(tC),p[0]=g,p[1]=t):t=p[1];let[v,y,A]=t,F=Math.sqrt(v*v+A*A+y*y),C=v/F,B=A/F,x=y/F;p[2]!==C||p[3]!==B||p[4]!==x?(r=new u.Vector3(C,B,x),p[2]=C,p[3]=B,p[4]=x,p[5]=r):r=p[5];let E=r,M=-(5e3*E.x),D=-(5e3*E.y),k=-(5e3*E.z);p[6]!==M||p[7]!==D||p[8]!==k?(a=new u.Vector3(M,D,k),p[6]=M,p[7]=D,p[8]=k,p[9]=a):a=p[9];let w=a;if(p[10]!==g){let[e,t,r]=((0,b.getProperty)(g,"color")??"0.7 0.7 0.7 1").split(" ").map(tb);s=new u.Color(e,t,r),p[10]=g,p[11]=s}else s=p[11];let I=s;if(p[12]!==g){let[e,t,r]=((0,b.getProperty)(g,"ambient")??"0.5 0.5 0.5 1").split(" ").map(tF);l=new u.Color(e,t,r),p[12]=g,p[13]=l}else l=p[13];let T=l,R=E.y<0;return p[14]!==R?(c=()=>{S.value=R},d=[R],p[14]=R,p[15]=c,p[16]=d):(c=p[15],d=p[16]),(0,o.useEffect)(c,d),p[17]!==I||p[18]!==w?(f=(0,n.jsx)("directionalLight",{position:w,color:I,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}),p[17]=I,p[18]=w,p[19]=f):f=p[19],p[20]!==T?(h=(0,n.jsx)("ambientLight",{color:T,intensity:1}),p[20]=T,p[21]=h):h=p[21],p[22]!==f||p[23]!==h?(m=(0,n.jsxs)(n.Fragment,{children:[f,h]}),p[22]=f,p[23]=h,p[24]=m):m=p[24],m},TerrainBlock:L,TSStatic:function(e){let t,r,a,o,s,l,u,c=(0,i.c)(17),{object:d}=e;c[0]!==d?(t=(0,b.getProperty)(d,"shapeName"),c[0]=d,c[1]=t):t=c[1];let f=t;c[2]!==d?(r=(0,b.getPosition)(d),c[2]=d,c[3]=r):r=c[3];let h=r;c[4]!==d?(a=(0,b.getRotation)(d),c[4]=d,c[5]=a):a=c[5];let m=a;c[6]!==d?(o=(0,b.getScale)(d),c[6]=d,c[7]=o):o=c[7];let p=o;return f||console.error(" missing shapeName for object",d),c[8]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)(tz,{}),c[8]=s):s=c[8],c[9]!==h||c[10]!==m||c[11]!==p?(l=(0,n.jsx)("group",{position:h,quaternion:m,scale:p,children:s}),c[9]=h,c[10]=m,c[11]=p,c[12]=l):l=c[12],c[13]!==d||c[14]!==f||c[15]!==l?(u=(0,n.jsx)(tk,{type:"TSStatic",object:d,shapeName:f,children:l}),c[13]=d,c[14]=f,c[15]=l,c[16]=u):u=c[16],u},Turret:function(e){let t,r,a,o,s,l,u,c,d,f,h,m=(0,i.c)(27),{object:p}=e;m[0]!==p?(t=(0,b.getProperty)(p,"dataBlock")??"",m[0]=p,m[1]=t):t=m[1];let g=t;m[2]!==p?(r=(0,b.getProperty)(p,"initialBarrel"),m[2]=p,m[3]=r):r=m[3];let v=r,y=(0,tZ.useDatablock)(g),A=(0,tZ.useDatablock)(v);m[4]!==p?(a=(0,b.getPosition)(p),m[4]=p,m[5]=a):a=m[5];let F=a;m[6]!==p?(o=(0,b.getRotation)(p),m[6]=p,m[7]=o):o=m[7];let C=o;m[8]!==p?(s=(0,b.getScale)(p),m[8]=p,m[9]=s):s=m[9];let B=s;m[10]!==y?(l=(0,b.getProperty)(y,"shapeFile"),m[10]=y,m[11]=l):l=m[11];let S=l;m[12]!==A?(u=(0,b.getProperty)(A,"shapeFile"),m[12]=A,m[13]=u):u=m[13];let x=u;return S||console.error(` missing shape for datablock: ${g}`),v&&!x&&console.error(` missing shape for barrel datablock: ${v}`),m[14]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)(tz,{}),m[14]=c):c=m[14],m[15]!==x||m[16]!==p?(d=x?(0,n.jsx)(tk,{type:"Turret",object:p,shapeName:x,children:(0,n.jsx)("group",{position:[0,1.5,0],children:(0,n.jsx)(tz,{})})}):null,m[15]=x,m[16]=p,m[17]=d):d=m[17],m[18]!==F||m[19]!==C||m[20]!==B||m[21]!==d?(f=(0,n.jsxs)("group",{position:F,quaternion:C,scale:B,children:[c,d]}),m[18]=F,m[19]=C,m[20]=B,m[21]=d,m[22]=f):f=m[22],m[23]!==p||m[24]!==S||m[25]!==f?(h=(0,n.jsx)(tk,{type:"Turret",object:p,shapeName:S,children:f}),m[23]=p,m[24]=S,m[25]=f,m[26]=h):h=m[26],h},WaterBlock:(0,o.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,r,a,o=(0,i.c)(7),{object:s}=e;o[0]!==s?(t=(0,b.getPosition)(s),o[0]=s,o[1]=t):t=o[1];let l=t;o[2]!==s?(r=(0,b.getProperty)(s,"name"),o[2]=s,o[3]=r):r=o[3];let u=r;return o[4]!==u||o[5]!==l?(a=u?(0,n.jsx)(e3.FloatingLabel,{position:l,opacity:.6,children:u}):null,o[4]=u,o[5]=l,o[6]=a):a=o[6],a}},t4=new Set(["ForceFieldBare","Item","StaticShape","Turret"]);function t6(e){let t,r,a,s=(0,i.c)(13),{object:l,objectId:u}=e,c=(0,R.useRuntimeObjectById)(u??l?._id)??l,{missionType:d}=(0,o.useContext)(t3),f=(0,R.useEngineSelector)(t7);e:{let e,r;if(!c){t=!1;break e}s[0]!==c?(e=new Set(((0,b.getProperty)(c,"missionTypesList")??"").toLowerCase().split(/\s+/).filter(Boolean)),s[0]=c,s[1]=e):e=s[1];let a=e;s[2]!==d||s[3]!==a?(r=!a.size||a.has(d.toLowerCase()),s[2]=d,s[3]=a,s[4]=r):r=s[4],t=r}let h=t;if(!c)return null;let m=t8[c._className];s[5]!==f||s[6]!==c._className?(r=f&&t4.has(c._className),s[5]=f,s[6]=c._className,s[7]=r):r=s[7];let p=r;return s[8]!==m||s[9]!==p||s[10]!==c||s[11]!==h?(a=h&&m?(0,n.jsx)(o.Suspense,{children:!p&&(0,n.jsx)(m,{object:c})}):null,s[8]=m,s[9]=p,s[10]=c,s[11]=h,s[12]=a):a=s[12],a}function t7(e){return null!=e.playback.recording}let re=(0,o.createContext)(null);function rt(e){let t,r,a=(0,i.c)(5),{runtime:o,children:s}=e;return a[0]!==s?(t=(0,n.jsx)(tP,{children:s}),a[0]=s,a[1]=t):t=a[1],a[2]!==o||a[3]!==t?(r=(0,n.jsx)(re.Provider,{value:o,children:t}),a[2]=o,a[3]=t,a[4]=r):r=a[4],r}var rr=e.i(86608),ra=e.i(38433),rn=e.i(33870),ri=e.i(91996);let ro=async e=>{let t;try{t=(0,y.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let r=await fetch(t);if(!r.ok)return console.error(`Script fetch failed: ${e} (${r.status})`),null;return await r.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}},rs=(0,rn.createScriptCache)(),rl={findFiles:e=>{let t=(0,v.default)(e,{nocase:!0});return(0,ri.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,ri.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,ri.getResourceMap)()[(0,ri.getResourceKey)(e)]};function ru(e){"batch.flushed"===e.type&&R.engineStore.getState().applyRuntimeBatch(e.events,{tick:e.tick})}function rc(e){e instanceof Error&&"AbortError"===e.name||console.error("Mission runtime failed to become ready:",e)}let rd=(0,o.memo)(function(e){let t,r,a,s,l,u,c,d,f=(0,i.c)(17),{name:h,missionType:m,onLoadingChange:p}=e,{data:v}=((d=(0,i.c)(2))[0]!==h?(c={queryKey:["parsedMission",h],queryFn:()=>(0,y.loadMission)(h)},d[0]=h,d[1]=c):c=d[1],(0,g.useQuery)(c)),{missionGroup:A,runtime:F,progress:b}=function(e,t,r){let a,n,s,l=(0,i.c)(6);l[0]===Symbol.for("react.memo_cache_sentinel")?(a={missionGroup:void 0,runtime:void 0,progress:0},l[0]=a):a=l[0];let[u,c]=(0,o.useState)(a);return l[1]!==e||l[2]!==t||l[3]!==r?(n=()=>{if(!r)return;let a=new AbortController,n=!1,i=null,o=(0,ra.createProgressTracker)(),s=()=>{c(e=>({...e,progress:o.progress}))};o.on("update",s);let{runtime:l,ready:u}=(0,rr.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:ro,fileSystem:rl,cache:rs,signal:a.signal,progress:o,ignoreScripts:["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]}});return u.then(()=>{n||a.signal.aborted||(R.engineStore.getState().setRuntime(l),c({missionGroup:l.getObjectByName("MissionGroup"),runtime:l,progress:1}))}).catch(rc),i=l.subscribeRuntimeEvents(ru),R.engineStore.getState().setRuntime(l),()=>{n=!0,o.off("update",s),a.abort(),i?.(),R.engineStore.getState().clearRuntime(),l.destroy()}},s=[e,t,r],l[1]=e,l[2]=t,l[3]=r,l[4]=n,l[5]=s):(n=l[4],s=l[5]),(0,o.useEffect)(n,s),u}(h,m,v),C=!v||!A||!F;f[0]!==A||f[1]!==m||f[2]!==v?(t={metadata:v,missionType:m,missionGroup:A},f[0]=A,f[1]=m,f[2]=v,f[3]=t):t=f[3];let B=t;return(f[4]!==C||f[5]!==p||f[6]!==b?(r=()=>{p?.(C,b)},a=[C,b,p],f[4]=C,f[5]=p,f[6]=b,f[7]=r,f[8]=a):(r=f[7],a=f[8]),(0,o.useEffect)(r,a),C)?null:(f[9]!==A?(s=(0,n.jsx)(t6,{object:A}),f[9]=A,f[10]=s):s=f[10],f[11]!==F||f[12]!==s?(l=(0,n.jsx)(rt,{runtime:F,children:s}),f[11]=F,f[12]=s,f[13]=l):l=f[13],f[14]!==B||f[15]!==l?(u=(0,n.jsx)(t9,{value:B,children:l}),f[14]=B,f[15]=l,f[16]=u):u=f[16],u)});var rf=e.i(19273),rh=e.i(86491),rm=e.i(40143),rp=e.i(15823),rg=class extends rp.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let a=t.queryKey,n=t.queryHash??(0,rf.hashQueryKeyByOptions)(a,t),i=this.get(n);return i||(i=new rh.Query({client:e,queryKey:a,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(a)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){rm.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,rf.matchQuery)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,rf.matchQuery)(e,t)):t}notify(e){rm.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){rm.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){rm.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rv=e.i(88587),ry=e.i(36553),rA=class extends rv.Removable{#t;#r;#a;#n;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#a=e.mutationCache,this.#r=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#r=this.#r.filter(t=>t!==e),this.scheduleGc(),this.#a.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#r.length||("pending"===this.state.status?this.scheduleGc():this.#a.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:"continue"})},r={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,ry.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#i({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#a.canRun(this)});let a="pending"===this.state.status,n=!this.#n.canStart();try{if(a)t();else{this.#i({type:"pending",variables:e,isPaused:n}),await this.#a.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#i({type:"pending",context:t,variables:e,isPaused:n})}let i=await this.#n.start();return await this.#a.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#a.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#i({type:"success",data:i}),i}catch(t){try{await this.#a.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#a.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#i({type:"error",error:t}),t}finally{this.#a.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),rm.notifyManager.batch(()=>{this.#r.forEach(t=>{t.onMutationUpdate(e)}),this.#a.notify({mutation:this,type:"updated",action:e})})}},rF=rp,rb=class extends rF.Subscribable{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#s=new Map,this.#l=0}#o;#s;#l;build(e,t,r){let a=new rA({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(a),a}add(e){this.#o.add(e);let t=rC(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=rC(e);if("string"==typeof t){let r=this.#s.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=rC(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),a=r?.find(e=>"pending"===e.state.status);return!a||a===e}}runNext(e){let t=rC(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){rm.notifyManager.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#s.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,rf.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,rf.matchMutation)(e,t))}notify(e){rm.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return rm.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(rf.noop))))}};function rC(e){return e.options.scope?.id}var rB=e.i(75555),rS=e.i(14448);function rx(e){return{onFetch:(t,r)=>{let a=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=(0,rf.ensureQueryFn)(t.options,t.fetchOptions),c=async(e,a,n)=>{let i;if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let o=(i={client:t.client,queryKey:t.queryKey,pageParam:a,direction:n?"backward":"forward",meta:t.options.meta},(0,rf.addConsumeAwareSignal)(i,()=>t.signal,()=>r=!0),i),s=await u(o),{maxPages:l}=t.options,c=n?rf.addToStart:rf.addToEnd;return{pages:c(e.pages,s,l),pageParams:c(e.pageParams,a,l)}};if(n&&i.length){let e="backward"===n,t={pages:i,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:rE)(a,t);s=await c(t,r,e)}else{let t=e??i.length;do{let e=0===l?o[0]??a.initialPageParam:rE(a,s);if(l>0&&null==e)break;s=await c(s,e),l++}while(lt.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function rE(e,{pages:t,pageParams:r}){let a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,r[a],r):void 0}var rM=class{#u;#a;#c;#d;#f;#h;#m;#p;constructor(e={}){this.#u=e.queryCache||new rg,this.#a=e.mutationCache||new rb,this.#c=e.defaultOptions||{},this.#d=new Map,this.#f=new Map,this.#h=0}mount(){this.#h++,1===this.#h&&(this.#m=rB.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=rS.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#h--,0===this.#h&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#a.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,rf.resolveStaleTime)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),n=this.#u.get(a.queryHash),i=n?.state.data,o=(0,rf.functionalUpdate)(t,i);if(void 0!==o)return this.#u.build(this,a).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return rm.notifyManager.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;rm.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return rm.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(rm.notifyManager.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(rf.noop).catch(rf.noop)}invalidateQueries(e,t={}){return rm.notifyManager.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(rm.notifyManager.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(rf.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(rf.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,rf.resolveStaleTime)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rf.noop).catch(rf.noop)}fetchInfiniteQuery(e){return e.behavior=rx(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rf.noop).catch(rf.noop)}ensureInfiniteQueryData(e){return e.behavior=rx(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return rS.onlineManager.isOnline()?this.#a.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#a}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,rf.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,rf.partialMatchKey)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#f.set((0,rf.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#f.values()],r={};return t.forEach(t=>{(0,rf.partialMatchKey)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,rf.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===rf.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#a.clear()}},rD=e.i(12598),rk=e.i(8155);let rw=e=>{let t=(0,rk.createStore)(e),r=e=>(function(e,t=e=>e){let r=o.default.useSyncExternalStore(e.subscribe,o.default.useCallback(()=>t(e.getState()),[e,t]),o.default.useCallback(()=>t(e.getInitialState()),[e,t]));return o.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r};var rI=e.i(79473);let rT=o.createContext(null);function rR({map:e,children:t,onChange:r,domElement:a}){let n=e.map(e=>e.name+e.keys).join("-"),i=o.useMemo(()=>{let t;return(t=(0,rI.subscribeWithSelector)(()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{})))?rw(t):rw},[n]),s=o.useMemo(()=>[i.subscribe,i.getState,i],[n]),l=i.setState;return o.useEffect(()=>{let t=e.map(({name:e,keys:t,up:a})=>({keys:t,up:a,fn:t=>{l({[e]:t}),r&&r(e,t,s[1]())}})).reduce((e,{keys:t,fn:r,up:a=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:a}),e),{}),n=({key:e,code:r})=>{let a=t[e]||t[r];if(!a)return;let{fn:n,pressed:i,up:o}=a;a.pressed=!0,(o||!i)&&n(!0)},i=({key:e,code:r})=>{let a=t[e]||t[r];if(!a)return;let{fn:n,up:i}=a;a.pressed=!1,i&&n(!1)},o=a||window;return o.addEventListener("keydown",n,{passive:!0}),o.addEventListener("keyup",i,{passive:!0}),()=>{o.removeEventListener("keydown",n),o.removeEventListener("keyup",i)}},[a,n]),o.createElement(rT.Provider,{value:s,children:t})}function rP(e){let[t,r,a]=o.useContext(rT);return e?a(e):[t,r]}var rG=Object.defineProperty;class rL{constructor(){((e,t,r)=>{let a;return(a="symbol"!=typeof t?t+"":t)in e?rG(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r})(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,a=r.length;t{let a;return(a="symbol"!=typeof t?t+"":t)in e?rj(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,r};let rO=new u.Euler(0,0,0,"YXZ"),rU=new u.Vector3,rH={type:"change"},rN={type:"lock"},rJ={type:"unlock"},rK=Math.PI/2;class rV extends rL{constructor(e,t){super(),r_(this,"camera"),r_(this,"domElement"),r_(this,"isLocked"),r_(this,"minPolarAngle"),r_(this,"maxPolarAngle"),r_(this,"pointerSpeed"),r_(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(rO.setFromQuaternion(this.camera.quaternion),rO.y-=.002*e.movementX*this.pointerSpeed,rO.x-=.002*e.movementY*this.pointerSpeed,rO.x=Math.max(rK-this.maxPolarAngle,Math.min(rK-this.minPolarAngle,rO.x)),this.camera.quaternion.setFromEuler(rO),this.dispatchEvent(rH))}),r_(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(rN),this.isLocked=!0):(this.dispatchEvent(rJ),this.isLocked=!1))}),r_(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),r_(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))}),r_(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))}),r_(this,"dispose",()=>{this.disconnect()}),r_(this,"getObject",()=>this.camera),r_(this,"direction",new u.Vector3(0,0,-1)),r_(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),r_(this,"moveForward",e=>{rU.setFromMatrixColumn(this.camera.matrix,0),rU.crossVectors(this.camera.up,rU),this.camera.position.addScaledVector(rU,e)}),r_(this,"moveRight",e=>{rU.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(rU,e)}),r_(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),r_(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)}}(a={}).forward="forward",a.backward="backward",a.left="left",a.right="right",a.up="up",a.down="down",a.lookUp="lookUp",a.lookDown="lookDown",a.lookLeft="lookLeft",a.lookRight="lookRight",a.camera1="camera1",a.camera2="camera2",a.camera3="camera3",a.camera4="camera4",a.camera5="camera5",a.camera6="camera6",a.camera7="camera7",a.camera8="camera8",a.camera9="camera9";let rz=Math.PI/2-.01;function rq(){let e,t,r,a,n,s,l,c,d,f,h,m,p,g=(0,i.c)(26),{speedMultiplier:v,setSpeedMultiplier:y}=(0,E.useControls)(),[b,C]=rP(),{camera:B,gl:S}=(0,F.useThree)(),{nextCamera:x,setCameraIndex:M,cameraCount:D}=t1(),k=(0,o.useRef)(null);g[0]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3,g[0]=e):e=g[0];let w=(0,o.useRef)(e);g[1]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Vector3,g[1]=t):t=g[1];let I=(0,o.useRef)(t);g[2]===Symbol.for("react.memo_cache_sentinel")?(r=new u.Vector3,g[2]=r):r=g[2];let T=(0,o.useRef)(r);g[3]===Symbol.for("react.memo_cache_sentinel")?(a=new u.Euler(0,0,0,"YXZ"),g[3]=a):a=g[3];let R=(0,o.useRef)(a);return g[4]!==B||g[5]!==S.domElement?(n=()=>{let e=new rV(B,S.domElement);return k.current=e,()=>{e.dispose()}},s=[B,S.domElement],g[4]=B,g[5]=S.domElement,g[6]=n,g[7]=s):(n=g[6],s=g[7]),(0,o.useEffect)(n,s),g[8]!==B||g[9]!==S.domElement||g[10]!==x?(l=()=>{let e=S.domElement,t=new u.Euler(0,0,0,"YXZ"),r=!1,a=!1,n=0,i=0,o=t=>{k.current?.isLocked||t.target===e&&(r=!0,a=!1,n=t.clientX,i=t.clientY)},s=e=>{!r||!a&&3>Math.abs(e.clientX-n)&&3>Math.abs(e.clientY-i)||(a=!0,t.setFromQuaternion(B.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-rz,Math.min(rz,t.x)),B.quaternion.setFromEuler(t))},l=()=>{r=!1},c=t=>{let r=k.current;!r||r.isLocked?x():t.target!==e||a||r.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),document.addEventListener("click",c),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),document.removeEventListener("click",c)}},c=[B,S.domElement,x],g[8]=B,g[9]=S.domElement,g[10]=x,g[11]=l,g[12]=c):(l=g[11],c=g[12]),(0,o.useEffect)(l,c),g[13]!==D||g[14]!==M||g[15]!==b?(d=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return b(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,r=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;y(e=>Math.max(.1,Math.min(5,Math.round((e+r)*20)/20)))},t=S.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},m=[S.domElement,y],g[18]=S.domElement,g[19]=y,g[20]=h,g[21]=m):(h=g[20],m=g[21]),(0,o.useEffect)(h,m),g[22]!==B||g[23]!==C||g[24]!==v?(p=(e,t)=>{let{forward:r,backward:a,left:n,right:i,up:o,down:s,lookUp:l,lookDown:u,lookLeft:c,lookRight:d}=C();if((l||u||c||d)&&(R.current.setFromQuaternion(B.quaternion,"YXZ"),c&&(R.current.y=R.current.y+ +t),d&&(R.current.y=R.current.y-t),l&&(R.current.x=R.current.x+ +t),u&&(R.current.x=R.current.x-t),R.current.x=Math.max(-rz,Math.min(rz,R.current.x)),B.quaternion.setFromEuler(R.current)),!r&&!a&&!n&&!i&&!o&&!s)return;let f=80*v;B.getWorldDirection(w.current),w.current.normalize(),I.current.crossVectors(B.up,w.current).normalize(),T.current.set(0,0,0),r&&T.current.add(w.current),a&&T.current.sub(w.current),n&&T.current.add(I.current),i&&T.current.sub(I.current),o&&(T.current.y=T.current.y+1),s&&(T.current.y=T.current.y-1),T.current.lengthSq()>0&&(T.current.normalize().multiplyScalar(f*t),B.position.add(T.current))},g[22]=B,g[23]=C,g[24]=v,g[25]=p):p=g[25],(0,A.useFrame)(p),null}let rQ=[{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 rW(){let e,t,r=(0,i.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],r[0]=e):e=r[0],(0,o.useEffect)(rX,e),r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)(rq,{}),r[1]=t):t=r[1],t}function rX(){return window.addEventListener("keydown",rY,{capture:!0}),window.addEventListener("keyup",rY,{capture:!0}),()=>{window.removeEventListener("keydown",rY,{capture:!0}),window.removeEventListener("keyup",rY,{capture:!0})}}function rY(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}function rZ(e){let t,r=(0,i.c)(2),{children:a}=e;return r[0]!==a?(t=(0,n.jsx)(n.Fragment,{children:a}),r[0]=a,r[1]=t):t=r[1],t}function r$(){return(0,R.useEngineSelector)(r0)}function r0(e){return e.playback.recording}function r1(){return(0,R.useEngineSelector)(r2)}function r2(e){return"playing"===e.playback.status}function r3(){return(0,R.useEngineSelector)(r9)}function r9(e){return e.playback.timeMs/1e3}function r5(e){return e.playback.durationMs/1e3}function r8(e){return e.playback.rate}function r4(){let e,t,r,a,n,o,s=(0,i.c)(17),l=r$(),u=(0,R.useEngineSelector)(at),c=(0,R.useEngineSelector)(ae),d=(0,R.useEngineSelector)(r7),f=(0,R.useEngineSelector)(r6);s[0]!==u?(e=e=>{u(e)},s[0]=u,s[1]=e):e=s[1];let h=e;s[2]!==l||s[3]!==c?(t=()=>{(!(l?.isMetadataOnly||l?.isPartial)||l.streamingPlayback)&&c("playing")},s[2]=l,s[3]=c,s[4]=t):t=s[4];let m=t;s[5]!==c?(r=()=>{c("paused")},s[5]=c,s[6]=r):r=s[6];let p=r;s[7]!==d?(a=e=>{d(1e3*e)},s[7]=d,s[8]=a):a=s[8];let g=a;s[9]!==f?(n=e=>{f(e)},s[9]=f,s[10]=n):n=s[10];let v=n;return s[11]!==p||s[12]!==m||s[13]!==g||s[14]!==h||s[15]!==v?(o={setRecording:h,play:m,pause:p,seek:g,setSpeed:v},s[11]=p,s[12]=m,s[13]=g,s[14]=h,s[15]=v,s[16]=o):o=s[16],o}function r6(e){return e.setPlaybackRate}function r7(e){return e.setPlaybackTime}function ae(e){return e.setPlaybackStatus}function at(e){return e.setDemoRecording}function ar(){let e,t,r,a,o,s,l,u,c,d,f,h,m,p,g,v,y,A,F,b,C,B,S,x,E=(0,i.c)(51),M=r$(),D=rP(af),k=rP(ad),w=rP(ac),I=rP(au),T=rP(al),R=rP(as),P=rP(ao),G=rP(ai),L=rP(an),j=rP(aa);return M?null:(E[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:"KeyboardOverlay-spacer"}),E[0]=e):e=E[0],E[1]!==D?(t=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":D,children:"W"}),E[1]=D,E[2]=t):t=E[2],E[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,n.jsx)("div",{className:"KeyboardOverlay-spacer"}),E[3]=r):r=E[3],E[4]!==t?(a=(0,n.jsxs)("div",{className:"KeyboardOverlay-row",children:[e,t,r]}),E[4]=t,E[5]=a):a=E[5],E[6]!==w?(o=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":w,children:"A"}),E[6]=w,E[7]=o):o=E[7],E[8]!==k?(s=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":k,children:"S"}),E[8]=k,E[9]=s):s=E[9],E[10]!==I?(l=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":I,children:"D"}),E[10]=I,E[11]=l):l=E[11],E[12]!==o||E[13]!==s||E[14]!==l?(u=(0,n.jsxs)("div",{className:"KeyboardOverlay-row",children:[o,s,l]}),E[12]=o,E[13]=s,E[14]=l,E[15]=u):u=E[15],E[16]!==a||E[17]!==u?(c=(0,n.jsxs)("div",{className:"KeyboardOverlay-column",children:[a,u]}),E[16]=a,E[17]=u,E[18]=c):c=E[18],E[19]===Symbol.for("react.memo_cache_sentinel")?(d=(0,n.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↑"}),E[19]=d):d=E[19],E[20]!==T?(f=(0,n.jsx)("div",{className:"KeyboardOverlay-row",children:(0,n.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":T,children:[d," Space"]})}),E[20]=T,E[21]=f):f=E[21],E[22]===Symbol.for("react.memo_cache_sentinel")?(h=(0,n.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↓"}),E[22]=h):h=E[22],E[23]!==R?(m=(0,n.jsx)("div",{className:"KeyboardOverlay-row",children:(0,n.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":R,children:[h," Shift"]})}),E[23]=R,E[24]=m):m=E[24],E[25]!==f||E[26]!==m?(p=(0,n.jsxs)("div",{className:"KeyboardOverlay-column",children:[f,m]}),E[25]=f,E[26]=m,E[27]=p):p=E[27],E[28]===Symbol.for("react.memo_cache_sentinel")?(g=(0,n.jsx)("div",{className:"KeyboardOverlay-spacer"}),E[28]=g):g=E[28],E[29]!==P?(v=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":P,children:"↑"}),E[29]=P,E[30]=v):v=E[30],E[31]===Symbol.for("react.memo_cache_sentinel")?(y=(0,n.jsx)("div",{className:"KeyboardOverlay-spacer"}),E[31]=y):y=E[31],E[32]!==v?(A=(0,n.jsxs)("div",{className:"KeyboardOverlay-row",children:[g,v,y]}),E[32]=v,E[33]=A):A=E[33],E[34]!==L?(F=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":L,children:"←"}),E[34]=L,E[35]=F):F=E[35],E[36]!==G?(b=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":G,children:"↓"}),E[36]=G,E[37]=b):b=E[37],E[38]!==j?(C=(0,n.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":j,children:"→"}),E[38]=j,E[39]=C):C=E[39],E[40]!==F||E[41]!==b||E[42]!==C?(B=(0,n.jsxs)("div",{className:"KeyboardOverlay-row",children:[F,b,C]}),E[40]=F,E[41]=b,E[42]=C,E[43]=B):B=E[43],E[44]!==A||E[45]!==B?(S=(0,n.jsxs)("div",{className:"KeyboardOverlay-column",children:[A,B]}),E[44]=A,E[45]=B,E[46]=S):S=E[46],E[47]!==p||E[48]!==S||E[49]!==c?(x=(0,n.jsxs)("div",{className:"KeyboardOverlay",children:[c,p,S]}),E[47]=p,E[48]=S,E[49]=c,E[50]=x):x=E[50],x)}function aa(e){return e.lookRight}function an(e){return e.lookLeft}function ai(e){return e.lookDown}function ao(e){return e.lookUp}function as(e){return e.down}function al(e){return e.up}function au(e){return e.right}function ac(e){return e.left}function ad(e){return e.backward}function af(e){return e.forward}let ah=Math.PI/2-.01;function am({joystickState:t,joystickZone:r,lookJoystickState:a,lookJoystickZone:i}){let{touchMode:s}=(0,E.useControls)();(0,o.useEffect)(()=>{let a=r.current;if(!a)return;let n=null,i=!1;return e.A(84968).then(e=>{i||((n=e.default.create({zone:a,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,r)=>{t.current.angle=r.angle.radian,t.current.force=Math.min(1,r.force)}),n.on("end",()=>{t.current.force=0}))}),()=>{i=!0,n?.destroy()}},[t,r,s]),(0,o.useEffect)(()=>{if("dualStick"!==s)return;let t=i.current;if(!t)return;let r=null,n=!1;return e.A(84968).then(e=>{n||((r=e.default.create({zone:t,mode:"static",position:{right:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,t)=>{a.current.angle=t.angle.radian,a.current.force=Math.min(1,t.force)}),r.on("end",()=>{a.current.force=0}))}),()=>{n=!0,r?.destroy()}},[s,a,i]);let l=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return"dualStick"===s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:r,className:"TouchJoystick TouchJoystick--left",onContextMenu:e=>e.preventDefault(),onTouchStart:l}),(0,n.jsx)("div",{ref:i,className:"TouchJoystick TouchJoystick--right",onContextMenu:e=>e.preventDefault(),onTouchStart:l})]}):(0,n.jsx)("div",{ref:r,className:"TouchJoystick",onContextMenu:e=>e.preventDefault(),onTouchStart:l})}function ap(e){let t,r,a,n,s,l,c,d,f,h,m=(0,i.c)(25),{joystickState:p,joystickZone:g,lookJoystickState:v}=e,{speedMultiplier:y,touchMode:b}=(0,E.useControls)(),{camera:C,gl:B}=(0,F.useThree)();m[0]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Euler(0,0,0,"YXZ"),m[0]=t):t=m[0];let S=(0,o.useRef)(t),x=(0,o.useRef)(null);m[1]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},m[1]=r):r=m[1];let M=(0,o.useRef)(r);m[2]===Symbol.for("react.memo_cache_sentinel")?(a=new u.Vector3,m[2]=a):a=m[2];let D=(0,o.useRef)(a);m[3]===Symbol.for("react.memo_cache_sentinel")?(n=new u.Vector3,m[3]=n):n=m[3];let k=(0,o.useRef)(n);m[4]===Symbol.for("react.memo_cache_sentinel")?(s=new u.Vector3,m[4]=s):s=m[4];let w=(0,o.useRef)(s);return m[5]!==C.quaternion?(l=()=>{S.current.setFromQuaternion(C.quaternion,"YXZ")},m[5]=C.quaternion,m[6]=l):l=m[6],m[7]!==C?(c=[C],m[7]=C,m[8]=c):c=m[8],(0,o.useEffect)(l,c),m[9]!==C.quaternion||m[10]!==B.domElement||m[11]!==g||m[12]!==b?(d=()=>{if("moveLookStick"!==b)return;let e=B.domElement,t=e=>{let t=g.current;if(!t)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom},r=e=>{if(null===x.current)for(let r=0;r{if(null!==x.current)for(let t=0;t{for(let t=0;t{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",a),e.removeEventListener("touchend",n),e.removeEventListener("touchcancel",n),x.current=null}},m[9]=C.quaternion,m[10]=B.domElement,m[11]=g,m[12]=b,m[13]=d):d=m[13],m[14]!==C||m[15]!==B.domElement||m[16]!==g||m[17]!==b?(f=[C,B.domElement,g,b],m[14]=C,m[15]=B.domElement,m[16]=g,m[17]=b,m[18]=f):f=m[18],(0,o.useEffect)(d,f),m[19]!==C||m[20]!==p.current||m[21]!==v||m[22]!==y||m[23]!==b?(h=(e,t)=>{let{force:r,angle:a}=p.current;if("dualStick"===b){let e=v.current;if(e.force>.15){let r=(e.force-.15)/.85,a=Math.cos(e.angle),n=Math.sin(e.angle);S.current.setFromQuaternion(C.quaternion,"YXZ"),S.current.y=S.current.y-a*r*2.5*t,S.current.x=S.current.x+n*r*2.5*t,S.current.x=Math.max(-ah,Math.min(ah,S.current.x)),C.quaternion.setFromEuler(S.current)}if(r>.08){let e=80*y*((r-.08)/.92),n=Math.cos(a),i=Math.sin(a);C.getWorldDirection(D.current),D.current.normalize(),k.current.crossVectors(C.up,D.current).normalize(),w.current.set(0,0,0).addScaledVector(D.current,i).addScaledVector(k.current,-n),w.current.lengthSq()>0&&(w.current.normalize().multiplyScalar(e*t),C.position.add(w.current))}}else if("moveLookStick"===b&&r>0){let e=80*y*.5;if(C.getWorldDirection(D.current),D.current.normalize(),w.current.copy(D.current).multiplyScalar(e*t),C.position.add(w.current),r>=.15){let e=Math.cos(a),n=Math.sin(a),i=(r-.15)/.85;S.current.setFromQuaternion(C.quaternion,"YXZ"),S.current.y=S.current.y-e*i*1.25*t,S.current.x=S.current.x+n*i*1.25*t,S.current.x=Math.max(-ah,Math.min(ah,S.current.x)),C.quaternion.setFromEuler(S.current)}}},m[19]=C,m[20]=p.current,m[21]=v,m[22]=y,m[23]=b,m[24]=h):h=m[24],(0,A.useFrame)(h),null}var ag="undefined"!=typeof window&&!!(null==(r=window.document)?void 0:r.createElement);function av(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function ay(e){return e?"self"in e?e.self:av(e).defaultView||window:self}function aA(e,t=!1){let{activeElement:r}=av(e);if(!(null==r?void 0:r.nodeName))return null;if(ab(r)&&r.contentDocument)return aA(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=av(r).getElementById(e);if(t)return t}}return r}function aF(e,t){return e===t||e.contains(t)}function ab(e){return"IFRAME"===e.tagName}function aC(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==aB.indexOf(e.type)}var aB=["button","color","file","image","reset","submit"];function aS(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function ax(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function aE(e){return e.isContentEditable||ax(e)}function aM(e){let t=0,r=0;if(ax(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let a=av(e).getSelection();if((null==a?void 0:a.rangeCount)&&a.anchorNode&&aF(e,a.anchorNode)&&a.focusNode&&aF(e,a.focusNode)){let n=a.getRangeAt(0),i=n.cloneRange();i.selectNodeContents(e),i.setEnd(n.startContainer,n.startOffset),t=i.toString().length,i.setEnd(n.endContainer,n.endOffset),r=i.toString().length}}return{start:t,end:r}}function aD(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function ak(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return ak(e.parentElement)||document.scrollingElement||document.body}function aw(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function aI(e,t){return t&&e.item(t)||null}var aT=Symbol("FOCUS_SILENTLY");function aR(e,t,r){if(!t||t===r)return!1;let a=e.item(t.id);return!!a&&(!r||a.element!==r)}function aP(){}function aG(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function aL(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function aj(e){return e}function a_(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function aO(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function aU(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function aH(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function aN(...e){for(let t of e)if(void 0!==t)return t}function aJ(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function aK(){return ag&&!!navigator.maxTouchPoints}function aV(){return!!ag&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function az(){return ag&&aV()&&/apple/i.test(navigator.vendor)}function aq(e){return!!(e.currentTarget&&!aF(e.currentTarget,e.target))}function aQ(e){return e.target===e.currentTarget}function aW(e,t){let r=new FocusEvent("blur",t),a=e.dispatchEvent(r),n={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",n)),a}function aX(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function aY(e,t){let r=t||e.currentTarget,a=e.relatedTarget;return!a||!aF(r,a)}function aZ(e,t,r,a){let n=(e=>{if(a){let t=setTimeout(e,a);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,i,!0),r()}),i=()=>{n(),r()};return e.addEventListener(t,i,{once:!0,capture:!0}),n}function a$(e,t,r,a=window){let n=[];try{for(let i of(a.document.addEventListener(e,t,r),Array.from(a.frames)))n.push(a$(e,t,r,i))}catch(e){}return()=>{try{a.document.removeEventListener(e,t,r)}catch(e){}for(let e of n)e()}}var a0={...o},a1=a0.useId;a0.useDeferredValue;var a2=a0.useInsertionEffect,a3=ag?o.useLayoutEffect:o.useEffect;function a9(e){let t=(0,o.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return a2?a2(()=>{t.current=e}):t.current=e,(0,o.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function a5(...e){return(0,o.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)aJ(r,t)}},e)}function a8(e){if(a1){let t=a1();return e||t}let[t,r]=(0,o.useState)(e);return a3(()=>{if(e||t)return;let a=Math.random().toString(36).slice(2,8);r(`id-${a}`)},[e,t]),e||t}function a4(e,t){let r=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,o.useEffect)(()=>()=>{r.current=!1},[])}function a6(){return(0,o.useReducer)(()=>[],[])}function a7(e){return a9("function"==typeof e?e:()=>e)}function ne(e,t,r=[]){let a=(0,o.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:a}}function nt(e=!1,t){let[r,a]=(0,o.useState)(null);return{portalRef:a5(a,t),portalNode:r,domReady:!e||r}}var nr=!1,na=!1,nn=0,ni=0;function no(e){let t,r;t=e.movementX||e.screenX-nn,r=e.movementY||e.screenY-ni,nn=e.screenX,ni=e.screenY,(t||r||0)&&(na=!0)}function ns(){na=!1}function nl(e){let t=o.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function nu(e,t){return o.memo(e,t)}function nc(e,t){let r,{wrapElement:a,render:i,...s}=t,l=a5(t.ref,i&&(0,o.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(o.isValidElement(i)){let e={...i.props,ref:l};r=o.cloneElement(i,function(e,t){let r={...e};for(let a in t){if(!aG(t,a))continue;if("className"===a){let a="className";r[a]=e[a]?`${e[a]} ${t[a]}`:t[a];continue}if("style"===a){let a="style";r[a]=e[a]?{...e[a],...t[a]}:t[a];continue}let n=t[a];if("function"==typeof n&&a.startsWith("on")){let t=e[a];if("function"==typeof t){r[a]=(...e)=>{n(...e),t(...e)};continue}}r[a]=n}return r}(s,e))}else r=i?i(s):(0,n.jsx)(e,{...s});return a?a(r):r}function nd(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function nf(e=[],t=[]){let r=o.createContext(void 0),a=o.createContext(void 0),i=()=>o.useContext(r),s=t=>e.reduceRight((e,r)=>(0,n.jsx)(r,{...t,children:e}),(0,n.jsx)(r.Provider,{...t}));return{context:r,scopedContext:a,useContext:i,useScopedContext:(e=!1)=>{let t=o.useContext(a),r=i();return e?t:t||r},useProviderContext:()=>{let e=o.useContext(a),t=i();if(!e||e!==t)return t},ContextProvider:s,ScopedContextProvider:e=>(0,n.jsx)(s,{...e,children:t.reduceRight((t,r)=>(0,n.jsx)(r,{...e,children:t}),(0,n.jsx)(a.Provider,{...e}))})}}var nh=nf(),nm=nh.useContext;nh.useScopedContext,nh.useProviderContext;var np=nf([nh.ContextProvider],[nh.ScopedContextProvider]),ng=np.useContext;np.useScopedContext;var nv=np.useProviderContext,ny=np.ContextProvider,nA=np.ScopedContextProvider,nF=(0,o.createContext)(void 0),nb=(0,o.createContext)(void 0),nC=(0,o.createContext)(!0),nB="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function nS(e){return!(!e.matches(nB)||!aS(e)||e.closest("[inert]"))}function nx(e){if(!nS(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=aA(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function nE(e,t){let r=Array.from(e.querySelectorAll(nB));t&&r.unshift(e);let a=r.filter(nS);return a.forEach((e,t)=>{if(ab(e)&&e.contentDocument){let r=e.contentDocument.body;a.splice(t,1,...nE(r))}}),a}function nM(e,t,r){let a=Array.from(e.querySelectorAll(nB)),n=a.filter(nx);return(t&&nx(e)&&n.unshift(e),n.forEach((e,t)=>{if(ab(e)&&e.contentDocument){let a=nM(e.contentDocument.body,!1,r);n.splice(t,1,...a)}}),!n.length&&r)?a:n}function nD(e,t){var r;let a,n,i,o;return r=document.body,a=aA(r),i=(n=nE(r,!1)).indexOf(a),(o=n.slice(i+1)).find(nx)||(e?n.find(nx):null)||(t?o[0]:null)||null}function nk(e,t){var r;let a,n,i,o;return r=document.body,a=aA(r),i=(n=nE(r,!1).reverse()).indexOf(a),(o=n.slice(i+1)).find(nx)||(e?n.find(nx):null)||(t?o[0]:null)||null}function nw(e){let t=aA(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function nI(e){let t=aA(e);if(!t)return!1;if(aF(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function nT(e){!nI(e)&&nS(e)&&e.focus()}var nR=az(),nP=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],nG=Symbol("safariFocusAncestor");function nL(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function nj(e,t){return a9(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var n_=!1,nO=!0;function nU(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(nO=!1)}function nH(e){e.metaKey||e.ctrlKey||e.altKey||(nO=!0)}var nN=nd(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:a,...n}){var i,s,l,u,c;let d=(0,o.useRef)(null);(0,o.useEffect)(()=>{!e||n_||(a$("mousedown",nU,!0),a$("keydown",nH,!0),n_=!0)},[e]),nR&&(0,o.useEffect)(()=>{if(!e)return;let t=d.current;if(!t||!nL(t))return;let r="labels"in t?t.labels:null;if(!r)return;let a=()=>queueMicrotask(()=>t.focus());for(let e of r)e.addEventListener("mouseup",a);return()=>{for(let e of r)e.removeEventListener("mouseup",a)}},[e]);let f=e&&aU(n),h=!!f&&!t,[m,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{e&&h&&m&&p(!1)},[e,h,m]),(0,o.useEffect)(()=>{if(!e||!m)return;let t=d.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{nS(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,m]);let g=nj(n.onKeyPressCapture,f),v=nj(n.onMouseDownCapture,f),y=nj(n.onClickCapture,f),A=n.onMouseDown,F=a9(t=>{if(null==A||A(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!nR||aq(t)||!aC(r)&&!nL(r))return;let a=!1,n=()=>{a=!0};r.addEventListener("focusin",n,{capture:!0,once:!0});let i=function(e){for(;e&&!nS(e);)e=e.closest(nB);return e||null}(r.parentElement);i&&(i[nG]=!0),aZ(r,"mouseup",()=>{r.removeEventListener("focusin",n,!0),i&&(i[nG]=!1),a||nT(r)})}),b=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let n=t.currentTarget;n&&nw(n)&&(null==a||a(t),t.defaultPrevented||(n.dataset.focusVisible="true",p(!0)))},C=n.onKeyDownCapture,B=a9(t=>{if(null==C||C(t),t.defaultPrevented||!e||m||t.metaKey||t.altKey||t.ctrlKey||!aQ(t))return;let r=t.currentTarget;aZ(r,"focusout",()=>b(t,r))}),S=n.onFocusCapture,x=a9(t=>{if(null==S||S(t),t.defaultPrevented||!e)return;if(!aQ(t))return void p(!1);let r=t.currentTarget;nO||function(e){let{tagName:t,readOnly:r,type:a}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:nP.includes(a))}(t.target)?aZ(t.target,"focusout",()=>b(t,r)):p(!1)}),E=n.onBlur,M=a9(t=>{null==E||E(t),!e||aY(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),D=(0,o.useContext)(nC),k=a9(t=>{e&&r&&t&&D&&queueMicrotask(()=>{nw(t)||nS(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[a,n]=(0,o.useState)(()=>r(void 0));return a3(()=>{let t=e&&"current"in e?e.current:e;n((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,void 0]),a}(d),I=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),T=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),R=n.style,P=(0,o.useMemo)(()=>h?{pointerEvents:"none",...R}:R,[h,R]);return n={"data-focus-visible":e&&m||void 0,"data-autofocus":r||void 0,"aria-disabled":f||void 0,...n,ref:a5(d,k,n.ref),style:P,tabIndex:(i=e,s=h,l=I,u=T,c=n.tabIndex,i?s?l&&!u?-1:void 0:l?c:c||0:c),disabled:!!T&&!!h||void 0,contentEditable:f?void 0:n.contentEditable,onKeyPressCapture:g,onClickCapture:y,onMouseDownCapture:v,onMouseDown:F,onKeyDownCapture:B,onFocusCapture:x,onBlur:M},aH(n)});function nJ(e){let t=[];for(let r of e)t.push(...r);return t}function nK(e){return e.slice().reverse()}function nV(e,t,r){return a9(a=>{var n;let i,o;if(null==t||t(a),a.defaultPrevented||a.isPropagationStopped()||!aQ(a)||"Shift"===a.key||"Control"===a.key||"Alt"===a.key||"Meta"===a.key||(!(i=a.target)||ax(i))&&1===a.key.length&&!a.ctrlKey&&!a.metaKey)return;let s=e.getState(),l=null==(n=aI(e,s.activeId))?void 0:n.element;if(!l)return;let{view:u,...c}=a;l!==(null==r?void 0:r.current)&&l.focus(),o=new KeyboardEvent(a.type,c),l.dispatchEvent(o)||a.preventDefault(),a.currentTarget.contains(l)&&a.stopPropagation()})}nl(function(e){return nc("div",nN(e))});var nz=nd(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:a=!0,...i}){let s=nv();a_(e=e||s,!1);let l=(0,o.useRef)(null),u=(0,o.useRef)(null),c=function(e){let[t,r]=(0,o.useState)(!1),a=(0,o.useCallback)(()=>r(!0),[]),n=e.useState(t=>aI(e,t.activeId));return(0,o.useEffect)(()=>{let e=null==n?void 0:n.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[n,t]),a}(e),d=e.useState("moves"),[,f]=function(e){let[t,r]=(0,o.useState)(null);return a3(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(t?e.setBaseElement:null);(0,o.useEffect)(()=>{var a;if(!e||!d||!t||!r)return;let{activeId:n}=e.getState(),i=null==(a=aI(e,n))?void 0:a.element;i&&("scrollIntoView"in i?(i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):i.focus())},[e,d,t,r]),a3(()=>{if(!e||!d||!t)return;let{baseElement:r,activeId:a}=e.getState();if(null!==a||!r)return;let n=u.current;u.current=null,n&&aW(n,{relatedTarget:r}),nw(r)||r.focus()},[e,d,t]);let h=e.useState("activeId"),m=e.useState("virtualFocus");a3(()=>{var r;if(!e||!t||!m)return;let a=u.current;if(u.current=null,!a)return;let n=(null==(r=aI(e,h))?void 0:r.element)||aA(a);n!==a&&aW(a,{relatedTarget:n})},[e,h,m,t]);let p=nV(e,i.onKeyDownCapture,u),g=nV(e,i.onKeyUpCapture,u),v=i.onFocusCapture,y=a9(t=>{var r;let a;if(null==v||v(t),t.defaultPrevented||!e)return;let{virtualFocus:n}=e.getState();if(!n)return;let i=t.relatedTarget,o=(a=(r=t.currentTarget)[aT],delete r[aT],a);aQ(t)&&o&&(t.stopPropagation(),u.current=i)}),A=i.onFocus,F=a9(r=>{if(null==A||A(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:a}=r,{virtualFocus:n}=e.getState();n?aQ(r)&&!aR(e,a)&&queueMicrotask(c):aQ(r)&&e.setActiveId(null)}),b=i.onBlurCapture,C=a9(t=>{var r;if(null==b||b(t),t.defaultPrevented||!e)return;let{virtualFocus:a,activeId:n}=e.getState();if(!a)return;let i=null==(r=aI(e,n))?void 0:r.element,o=t.relatedTarget,s=aR(e,o),l=u.current;u.current=null,aQ(t)&&s?(o===i?l&&l!==o&&aW(l,t):i?aW(i,t):l&&aW(l,t),t.stopPropagation()):!aR(e,t.target)&&i&&aW(i,t)}),B=i.onKeyDown,S=a7(a),x=a9(t=>{var r;if(null==B||B(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!aQ(t))return;let{orientation:a,renderedItems:n,activeId:i}=e.getState(),o=aI(e,i);if(null==(r=null==o?void 0:o.element)?void 0:r.isConnected)return;let s="horizontal"!==a,l="vertical"!==a,u=n.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&ax(t.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=nJ(nK(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(n))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==e?void 0:e.last()}),ArrowRight:(u||l)&&e.first,ArrowDown:(u||s)&&e.first,ArrowLeft:(u||l)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];if(c){let r=c();if(void 0!==r){if(!S(t))return;t.preventDefault(),e.move(r)}}});return i=ne(i,t=>(0,n.jsx)(ny,{value:e,children:t}),[e]),i={"aria-activedescendant":e.useState(r=>{var a;if(e&&t&&r.virtualFocus)return null==(a=aI(e,r.activeId))?void 0:a.id}),...i,ref:a5(l,f,i.ref),onKeyDownCapture:p,onKeyUpCapture:g,onFocusCapture:y,onFocus:F,onBlurCapture:C,onKeyDown:x},i=nN({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...i})});nl(function(e){return nc("div",nz(e))});var nq=nf();nq.useContext,nq.useScopedContext;var nQ=nq.useProviderContext,nW=nf([nq.ContextProvider],[nq.ScopedContextProvider]);nW.useContext,nW.useScopedContext;var nX=nW.useProviderContext,nY=nW.ContextProvider,nZ=nW.ScopedContextProvider,n$=(0,o.createContext)(void 0),n0=(0,o.createContext)(void 0),n1=nf([nY],[nZ]);n1.useContext,n1.useScopedContext;var n2=n1.useProviderContext,n3=n1.ContextProvider,n9=n1.ScopedContextProvider,n5=nd(function({store:e,...t}){let r=n2();return e=e||r,t={...t,ref:a5(null==e?void 0:e.setAnchorElement,t.ref)}});nl(function(e){return nc("div",n5(e))});var n8=(0,o.createContext)(void 0),n4=nf([n3,ny],[n9,nA]),n6=n4.useContext,n7=n4.useScopedContext,ie=n4.useProviderContext,it=n4.ContextProvider,ir=n4.ScopedContextProvider,ia=(0,o.createContext)(void 0),ii=(0,o.createContext)(!1);function io(e,t){let r=e.__unstableInternals;return a_(r,"Invalid store"),r[t]}function is(e,...t){let r=e,a=r,n=Symbol(),i=aP,o=new Set,s=new Set,l=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,h=(e,t,r=u)=>(r.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),r.delete(t)}),m=(e,i,o=!1)=>{var l,h;if(!aG(r,e))return;let m=(h=r[e],"function"==typeof i?i("function"==typeof h?h():h):i);if(m===r[e])return;if(!o)for(let r of t)null==(l=null==r?void 0:r.setState)||l.call(r,e,m);let p=r;r={...r,[e]:m};let g=Symbol();n=g,s.add(e);let v=(t,a,n)=>{var i;let o=f.get(t);(!o||o.some(t=>n?n.has(t):t===e))&&(null==(i=d.get(t))||i(),d.set(t,t(r,a)))};for(let e of u)v(e,p);queueMicrotask(()=>{if(n!==g)return;let e=r;for(let e of c)v(e,a,s);a=e,s.clear()})},p={getState:()=>r,setState:m,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{let e=o.size,a=Symbol();o.add(a);let n=()=>{o.delete(a),o.size||i()};if(e)return n;let s=Object.keys(r).map(e=>aL(...t.map(t=>{var r;let a=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(a&&aG(a,e))return id(t,[e],t=>{m(e,t[e],!0)})}))),u=[];for(let e of l)u.push(e());return i=aL(...s,...u,...t.map(iu)),n},subscribe:(e,t)=>h(e,t),sync:(e,t)=>(d.set(t,t(r,r)),h(e,t)),batch:(e,t)=>(d.set(t,t(r,a)),h(e,t,c)),pick:e=>is(function(e,t){let r={};for(let a of t)aG(e,a)&&(r[a]=e[a]);return r}(r,e),p),omit:e=>is(function(e,t){let r={...e};for(let e of t)aG(r,e)&&delete r[e];return r}(r,e),p)}};return p}function il(e,...t){if(e)return io(e,"setup")(...t)}function iu(e,...t){if(e)return io(e,"init")(...t)}function ic(e,...t){if(e)return io(e,"subscribe")(...t)}function id(e,...t){if(e)return io(e,"sync")(...t)}function ih(e,...t){if(e)return io(e,"batch")(...t)}function im(e,...t){if(e)return io(e,"omit")(...t)}function ip(...e){var t;let r={};for(let a of e){let e=null==(t=null==a?void 0:a.getState)?void 0:t.call(a);e&&Object.assign(r,e)}let a=is(r,...e);return Object.assign({},...e,a)}function ig(e,t){}function iv(e,t,r){if(!r)return!1;let a=e.find(e=>!e.disabled&&e.value);return(null==a?void 0:a.value)===t}function iy(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var iA=nd(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:a,setValueOnChange:n,showMinLength:i=0,showOnChange:s,showOnMouseDown:l,showOnClick:u=l,showOnKeyDown:c,showOnKeyPress:d=c,blurActiveItemOnClick:f,setValueOnClick:h=!0,moveOnKeyPress:m=!0,autoComplete:p="list",...g}){var v;let y,A=ie();a_(e=e||A,!1);let F=(0,o.useRef)(null),[b,C]=a6(),B=(0,o.useRef)(!1),S=(0,o.useRef)(!1),x=e.useState(e=>e.virtualFocus&&r),E="inline"===p||"both"===p,[M,D]=(0,o.useState)(E);v=[E],y=(0,o.useRef)(!1),a3(()=>{if(y.current)return(()=>{E&&D(!0)})();y.current=!0},v),a3(()=>()=>{y.current=!1},[]);let k=e.useState("value"),w=(0,o.useRef)();(0,o.useEffect)(()=>id(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let I=e.useState(e=>{var t;if(E&&M){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),T=e.useState("renderedItems"),R=e.useState("open"),P=e.useState("contentElement"),G=(0,o.useMemo)(()=>{if(!E||!M)return k;if(iv(T,I,x)){if(iy(k,I)){let e=(null==I?void 0:I.slice(k.length))||"";return k+e}return k}return I||k},[E,M,T,I,x,k]);(0,o.useEffect)(()=>{let e=F.current;if(!e)return;let t=()=>D(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,o.useEffect)(()=>{if(!E||!M||!I||!iv(T,I,x)||!iy(k,I))return;let e=aP;return queueMicrotask(()=>{let t=F.current;if(!t)return;let{start:r,end:a}=aM(t),n=k.length,i=I.length;aw(t,n,i),e=()=>{if(!nw(t))return;let{start:e,end:o}=aM(t);e!==n||o===i&&aw(t,r,a)}}),()=>e()},[b,E,M,I,T,x,k]);let L=(0,o.useRef)(null),j=a9(a),_=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!R||!P)return;let t=ak(P);if(!t)return;L.current=t;let r=()=>{B.current=!1},a=()=>{if(!e||!B.current)return;let{activeId:t}=e.getState();null===t||t!==_.current&&(B.current=!1)},n={passive:!0,capture:!0};return t.addEventListener("wheel",r,n),t.addEventListener("touchmove",r,n),t.addEventListener("scroll",a,n),()=>{t.removeEventListener("wheel",r,!0),t.removeEventListener("touchmove",r,!0),t.removeEventListener("scroll",a,!0)}},[R,P,e]),a3(()=>{!k||S.current||(B.current=!0)},[k]),a3(()=>{"always"!==x&&R||(B.current=R)},[x,R]);let O=e.useState("resetValueOnSelect");a4(()=>{var t,r;let a=B.current;if(!e||!R||!a&&!O)return;let{baseElement:n,contentElement:i,activeId:o}=e.getState();if(!n||nw(n)){if(null==i?void 0:i.hasAttribute("data-placing")){let e=new MutationObserver(C);return e.observe(i,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(x&&a){let r,a=j(T),n=void 0!==a?a:null!=(t=null==(r=T.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();_.current=n,e.move(null!=n?n:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,R,b,k,x,O,j,T]),(0,o.useEffect)(()=>{if(!E)return;let t=F.current;if(!t)return;let r=[t,P].filter(e=>!!e),a=t=>{r.every(e=>aY(t,e))&&(null==e||e.setValue(G))};for(let e of r)e.addEventListener("focusout",a);return()=>{for(let e of r)e.removeEventListener("focusout",a)}},[E,P,e,G]);let U=e=>e.currentTarget.value.length>=i,H=g.onChange,N=a7(null!=s?s:U),J=a7(null!=n?n:!e.tag),K=a9(t=>{if(null==H||H(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:a,selectionStart:n,selectionEnd:i}=r,o=t.nativeEvent;if(B.current=!0,"input"===o.type&&(o.isComposing&&(B.current=!1,S.current=!0),E)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=n===a.length;D(e&&t)}if(J(t)){let t=a===e.getState().value;e.setValue(a),queueMicrotask(()=>{aw(r,n,i)}),E&&x&&t&&C()}N(t)&&e.show(),x&&B.current||e.setActiveId(null)}),V=g.onCompositionEnd,z=a9(e=>{B.current=!0,S.current=!1,null==V||V(e),e.defaultPrevented||x&&C()}),q=g.onMouseDown,Q=a7(null!=f?f:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=a7(h),X=a7(null!=u?u:U),Y=a9(t=>{null==q||q(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(Q(t)&&e.setActiveId(null),W(t)&&e.setValue(G),X(t)&&aZ(t.currentTarget,"mouseup",e.show))}),Z=g.onKeyDown,$=a7(null!=d?d:U),ee=a9(t=>{if(null==Z||Z(t),t.repeat||(B.current=!1),t.defaultPrevented||t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||!e)return;let{open:r}=e.getState();!r&&("ArrowUp"===t.key||"ArrowDown"===t.key)&&$(t)&&(t.preventDefault(),e.show())}),et=g.onBlur,er=a9(e=>{if(B.current=!1,null==et||et(e),e.defaultPrevented)return}),ea=a8(g.id),en=e.useState(e=>null===e.activeId);return g={id:ea,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":aD(P,"listbox"),"aria-expanded":R,"aria-controls":null==P?void 0:P.id,"data-active-item":en||void 0,value:G,...g,ref:a5(F,g.ref),onChange:K,onCompositionEnd:z,onMouseDown:Y,onKeyDown:ee,onBlur:er},g=nz({store:e,focusable:t,...g,moveOnKeyPress:e=>!aO(m,e)&&(E&&D(!0),!0)}),{autoComplete:"off",...g=n5({store:e,...g})}}),iF=nl(function(e){return nc("input",iA(e))});function ib(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var iC=Symbol("composite-hover"),iB=nd(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...a}){let n=ng();a_(e=e||n,!1);let i=((0,o.useEffect)(()=>{nr||(a$("mousemove",no,!0),a$("mousedown",ns,!0),a$("mouseup",ns,!0),a$("keydown",ns,!0),a$("scroll",ns,!0),nr=!0)},[]),a9(()=>na)),s=a.onMouseMove,l=a7(t),u=a9(t=>{if((null==s||s(t),!t.defaultPrevented&&i())&&l(t)){if(!nI(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!nw(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),c=a.onMouseLeave,d=a7(r),f=a9(t=>{var r;let a;null==c||c(t),!t.defaultPrevented&&i()&&((a=ib(t))&&aF(t.currentTarget,a)||function(e){let t=ib(e);if(!t)return!1;do{if(aG(t,iC)&&t[iC])return!0;t=t.parentElement}while(t)return!1}(t)||!l(t)||d(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),h=(0,o.useCallback)(e=>{e&&(e[iC]=!0)},[]);return aH(a={...a,ref:a5(h,a.ref),onMouseMove:u,onMouseLeave:f})});nu(nl(function(e){return nc("div",iB(e))}));var iS=nd(function({store:e,shouldRegisterItem:t=!0,getItem:r=aj,element:a,...n}){let i=nm();e=e||i;let s=a8(n.id),l=(0,o.useRef)(a);return(0,o.useEffect)(()=>{let a=l.current;if(!s||!a||!t)return;let n=r({id:s,element:a});return null==e?void 0:e.renderItem(n)},[s,t,r,e]),aH(n={...n,ref:a5(l,n.ref)})});function ix(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?aC(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(aC(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}nl(function(e){return nc("div",iS(e))});var iE=Symbol("command"),iM=nd(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let a,n,i=(0,o.useRef)(null),[s,l]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i.current&&l(aC(i.current))},[]);let[u,c]=(0,o.useState)(!1),d=(0,o.useRef)(!1),f=aU(r),[h,m]=(a=r.onLoadedMetadataCapture,n=(0,o.useMemo)(()=>Object.assign(()=>{},{...a,[iE]:!0}),[a,iE,!0]),[null==a?void 0:a[iE],{onLoadedMetadataCapture:n}]),p=r.onKeyDown,g=a9(r=>{null==p||p(r);let a=r.currentTarget;if(r.defaultPrevented||h||f||!aQ(r)||ax(a)||a.isContentEditable)return;let n=e&&"Enter"===r.key,i=t&&" "===r.key,o="Enter"===r.key&&!e,s=" "===r.key&&!t;if(o||s)return void r.preventDefault();if(n||i){let e=ix(r);if(n){if(!e){r.preventDefault();let{view:e,...t}=r,n=()=>aX(a,t);ag&&/firefox\//i.test(navigator.userAgent)?aZ(a,"keyup",n):queueMicrotask(n)}}else i&&(d.current=!0,e||(r.preventDefault(),c(!0)))}}),v=r.onKeyUp,y=a9(e=>{if(null==v||v(e),e.defaultPrevented||h||f||e.metaKey)return;let r=t&&" "===e.key;if(d.current&&r&&(d.current=!1,!ix(e))){e.preventDefault(),c(!1);let t=e.currentTarget,{view:r,...a}=e;queueMicrotask(()=>aX(t,a))}});return nN(r={"data-active":u||void 0,type:s?"button":void 0,...m,...r,ref:a5(i,r.ref),onKeyDown:g,onKeyUp:y})});nl(function(e){return nc("button",iM(e))});var{useSyncExternalStore:iD}=e.i(2239).default,ik=()=>()=>{};function iw(e,t=aj){let r=o.useCallback(t=>e?ic(e,null,t):ik(),[e]),a=()=>{let r="string"==typeof t?t:null,a="function"==typeof t?t:null,n=null==e?void 0:e.getState();return a?a(n):n&&r&&aG(n,r)?n[r]:void 0};return iD(r,a,a)}function iI(e,t){let r=o.useRef({}),a=o.useCallback(t=>e?ic(e,null,t):ik(),[e]),n=()=>{let a=null==e?void 0:e.getState(),n=!1,i=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(a);t!==i[e]&&(i[e]=t,n=!0)}if("string"==typeof r){if(!a||!aG(a,r))continue;let t=a[r];t!==i[e]&&(i[e]=t,n=!0)}}return n&&(r.current={...i}),r.current};return iD(a,n,n)}function iT(e,t,r,a){var n;let i,s=aG(t,r)?t[r]:void 0,l=(n={value:s,setValue:a?t[a]:void 0},i=(0,o.useRef)(n),a3(()=>{i.current=n}),i);a3(()=>id(e,[r],(e,t)=>{let{value:a,setValue:n}=l.current;n&&e[r]!==t[r]&&e[r]!==a&&n(e[r])}),[e,r]),a3(()=>{if(void 0!==s)return e.setState(r,s),ih(e,[r],()=>{void 0!==s&&e.setState(r,s)})})}function iR(e,t){let[r,a]=o.useState(()=>e(t));a3(()=>iu(r),[r]);let n=o.useCallback(e=>iw(r,e),[r]);return[o.useMemo(()=>({...r,useState:n}),[r,n]),a9(()=>{a(r=>e({...t,...r.getState()}))})]}function iP(e,t,r,a=!1){var n;let i,o;if(!t||!r)return;let{renderedItems:s}=t.getState(),l=ak(e);if(!l)return;let u=function(e,t=!1){let r=e.clientHeight,{top:a}=e.getBoundingClientRect(),n=1.5*Math.max(.875*r,r-40),i=t?r-n+a:n+a;return"HTML"===e.tagName?i+e.scrollTop:i}(l,a);for(let e=0;e=0){void 0!==o&&ot||(e&&(null==m?void 0:m.baseElement)&&m.baseElement===e.baseElement?m.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===f,ariaSetSize:e=>null!=l?l:e&&(null==m?void 0:m.ariaSetSize)&&m.baseElement===e.baseElement?m.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e||!(null==m?void 0:m.ariaPosInSet)||m.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===g);return m.ariaPosInSet+t.findIndex(e=>e.id===f)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(i)return!0;if(null===t.activeId)return!1;let r=null==e?void 0:e.item(t.activeId);return null!=r&&!!r.disabled||null==r||!r.element||t.activeId===f}}),C=(0,o.useCallback)(e=>{var t;let r={...e,id:f||e.id,rowId:g,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return s?s(r):r},[f,g,p,s]),B=c.onFocus,S=(0,o.useRef)(!1),x=a9(t=>{var r,a;if(null==B||B(t),t.defaultPrevented||aq(t)||!f||!e||(r=e,!aQ(t)&&aR(r,t.target)))return;let{virtualFocus:n,baseElement:i}=e.getState();e.setActiveId(f),aE(t.currentTarget)&&function(e,t=!1){if(ax(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=av(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!n||!aQ(t)||!aE(a=t.currentTarget)&&("INPUT"!==a.tagName||aC(a))&&(null==i?void 0:i.isConnected)&&((az()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),S.current=!0,t.relatedTarget===i||aR(e,t.relatedTarget))?(i[aT]=!0,i.focus({preventScroll:!0})):i.focus())}),E=c.onBlurCapture,M=a9(t=>{if(null==E||E(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&S.current&&(S.current=!1,t.preventDefault(),t.stopPropagation())}),D=c.onKeyDown,k=a7(r),w=a7(a),I=a9(t=>{if(null==D||D(t),t.defaultPrevented||!aQ(t)||!e)return;let{currentTarget:r}=t,a=e.getState(),n=e.item(f),i=!!(null==n?void 0:n.rowId),o="horizontal"!==a.orientation,s="vertical"!==a.orientation,l=()=>!(!i&&!s&&a.baseElement&&ax(a.baseElement)),u={ArrowUp:(i||o)&&e.up,ArrowRight:(i||s)&&e.next,ArrowDown:(i||o)&&e.down,ArrowLeft:(i||s)&&e.previous,Home:()=>{if(l())return!i||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(l())return!i||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>iP(r,e,null==e?void 0:e.up,!0),PageDown:()=>iP(r,e,null==e?void 0:e.down)}[t.key];if(u){if(aE(r)){let e=aM(r),a=s&&"ArrowLeft"===t.key,n=s&&"ArrowRight"===t.key,i=o&&"ArrowUp"===t.key,l=o&&"ArrowDown"===t.key;if(n||l){let{length:t}=function(e){if(ax(e))return e.value;if(e.isContentEditable){let t=av(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((a||i)&&0!==e.start)return}let a=u();if(k(t)||void 0!==a){if(!w(t))return;t.preventDefault(),e.move(a)}}}),T=(0,o.useMemo)(()=>({id:f,baseElement:v}),[f,v]);return c={id:f,"data-active-item":y||void 0,...c=ne(c,e=>(0,n.jsx)(nF.Provider,{value:T,children:e}),[T]),ref:a5(h,c.ref),tabIndex:b?c.tabIndex:-1,onFocus:x,onBlurCapture:M,onKeyDown:I},c=iM(c),aH({...c=iS({store:e,...c,getItem:C,shouldRegisterItem:!!f&&c.shouldRegisterItem}),"aria-setsize":A,"aria-posinset":F})});nu(nl(function(e){return nc("button",iG(e))}));var iL=nd(function({store:e,value:t,hideOnClick:r,setValueOnClick:a,selectValueOnClick:i=!0,resetValueOnSelect:s,focusOnHover:l=!1,moveOnKeyPress:u=!0,getItem:c,...d}){var f,h;let m=n7();a_(e=e||m,!1);let{resetValueOnSelectState:p,multiSelectable:g,selected:v}=iI(e,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,t)}),y=(0,o.useCallback)(e=>{let r={...e,value:t};return c?c(r):r},[t,c]);a=null!=a?a:!g,r=null!=r?r:null!=t&&!g;let A=d.onClick,F=a7(a),b=a7(i),C=a7(null!=(f=null!=s?s:p)?f:g),B=a7(r),S=a9(r=>{null==A||A(r),r.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(r)||!function(e){let t=e.currentTarget;if(!t)return!1;let r=aV();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let a=t.tagName.toLowerCase();return"a"===a||"button"===a&&"submit"===t.type||"input"===a&&"submit"===t.type}(r)&&(null!=t&&(b(r)&&(C(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),F(r)&&(null==e||e.setValue(t))),B(r)&&(null==e||e.hide()))}),x=d.onKeyDown,E=a9(t=>{if(null==x||x(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||nw(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),ax(r)&&(null==e||e.setValue(r.value)))});g&&null!=v&&(d={"aria-selected":v,...d}),d=ne(d,e=>(0,n.jsx)(ia.Provider,{value:t,children:(0,n.jsx)(ii.Provider,{value:null!=v&&v,children:e})}),[t,v]),d={role:null!=(h=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,o.useContext)(n8)])?h:"option",children:t,...d,onClick:S,onKeyDown:E};let M=a7(u);return d=iG({store:e,...d,getItem:y,moveOnKeyPress:t=>{if(!M(t))return!1;let r=new Event("combobox-item-move"),a=null==e?void 0:e.getState().baseElement;return null==a||a.dispatchEvent(r),!0}}),d=iB({store:e,focusOnHover:l,...d})}),ij=nu(nl(function(e){return nc("div",iL(e))})),i_=e.i(74080);function iO(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function iU(...e){return e.join(", ").split(", ").reduce((e,t)=>{let r=t.endsWith("ms")?1:1e3,a=Number.parseFloat(t||"0s")*r;return a>e?a:e},0)}function iH(e,t,r){return!r&&!1!==t&&(!e||!!t)}var iN=nd(function({store:e,alwaysVisible:t,...r}){let a=nQ();a_(e=e||a,!1);let i=(0,o.useRef)(null),s=a8(r.id),[l,u]=(0,o.useState)(null),c=e.useState("open"),d=e.useState("mounted"),f=e.useState("animated"),h=e.useState("contentElement"),m=iw(e.disclosure,"contentElement");a3(()=>{i.current&&(null==e||e.setContentElement(i.current))},[e]),a3(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),a3(()=>{if(f){var e;let t;return(null==h?void 0:h.isConnected)?(e=()=>{u(c?"enter":d?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void u(null)}},[f,h,c,d]),a3(()=>{if(!e||!f||!l||!h)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,i_.flushSync)(t);if("leave"===l&&c||"enter"===l&&!c)return;if("number"==typeof f)return iO(f,r);let{transitionDuration:a,animationDuration:n,transitionDelay:i,animationDelay:o}=getComputedStyle(h),{transitionDuration:s="0",animationDuration:u="0",transitionDelay:d="0",animationDelay:p="0"}=m?getComputedStyle(m):{},g=iU(i,o,d,p)+iU(a,n,s,u);if(!g){"enter"===l&&e.setState("animated",!1),t();return}return iO(Math.max(g-1e3/60,0),r)},[e,f,h,m,c,l]);let p=iH(d,(r=ne(r,t=>(0,n.jsx)(nZ,{value:e,children:t}),[e])).hidden,t),g=r.style,v=(0,o.useMemo)(()=>p?{...g,display:"none"}:g,[p,g]);return aH(r={id:s,"data-open":c||void 0,"data-enter":"enter"===l||void 0,"data-leave":"leave"===l||void 0,hidden:p,...r,ref:a5(s?e.setContentElement:null,i,r.ref),style:v})}),iJ=nl(function(e){return nc("div",iN(e))});nl(function({unmountOnHide:e,...t}){let r=nQ();return!1===iw(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,n.jsx)(iJ,{...t})});var iK=nd(function({store:e,alwaysVisible:t,...r}){let a=n7(!0),i=n6(),s=!!(e=e||i)&&e===a;a_(e,!1);let l=(0,o.useRef)(null),u=a8(r.id),c=e.useState("mounted"),d=iH(c,r.hidden,t),f=d?{...r.style,display:"none"}:r.style,h=e.useState(e=>Array.isArray(e.selectedValue)),m=function(e,t,r){let a=function(e){let[t]=(0,o.useState)(e);return t}(r),[n,i]=(0,o.useState)(a);return(0,o.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let n=()=>{let e=r.getAttribute(t);i(null==e?a:e)},o=new MutationObserver(n);return o.observe(r,{attributeFilter:[t]}),n(),()=>o.disconnect()},[e,t,a]),n}(l,"role",r.role),p="listbox"===m||"tree"===m||"grid"===m,[g,v]=(0,o.useState)(!1),y=e.useState("contentElement");a3(()=>{if(!c)return;let e=l.current;if(!e||y!==e)return;let t=()=>{v(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[c,y]),g||(r={role:"listbox","aria-multiselectable":p&&h||void 0,...r}),r=ne(r,t=>(0,n.jsx)(ir,{value:e,children:(0,n.jsx)(n8.Provider,{value:m,children:t})}),[e,m]);let A=!u||a&&s?null:e.setContentElement;return aH(r={id:u,hidden:d,...r,ref:a5(A,l,r.ref),style:f})}),iV=nl(function(e){return nc("div",iK(e))}),iz=(0,o.createContext)(null),iq=nd(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});nl(function(e){return nc("span",iq(e))});var iQ=nd(function(e){return iq(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),iW=nl(function(e){return nc("span",iQ(e))});function iX(e){queueMicrotask(()=>{null==e||e.focus()})}var iY=nd(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:a,portal:i=!0,...s}){let l=(0,o.useRef)(null),u=a5(l,s.ref),c=(0,o.useContext)(iz),[d,f]=(0,o.useState)(null),[h,m]=(0,o.useState)(null),p=(0,o.useRef)(null),g=(0,o.useRef)(null),v=(0,o.useRef)(null),y=(0,o.useRef)(null);return a3(()=>{let e=l.current;if(!e||!i)return void f(null);let t=r?"function"==typeof r?r(e):r:av(e).createElement("div");if(!t)return void f(null);let n=t.isConnected;if(n||(c||av(e).body).appendChild(t),t.id||(t.id=e.id?`portal/${e.id}`:function(e="id"){return`${e?`${e}-`:""}${Math.random().toString(36).slice(2,8)}`}()),f(t),aJ(a,t),!n)return()=>{t.remove(),aJ(a,null)}},[i,r,c,a]),a3(()=>{if(!i||!e||!t)return;let r=av(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),m(r),()=>{r.remove(),m(null)}},[i,e,t]),(0,o.useEffect)(()=>{if(!d||!e)return;let t=0,r=e=>{if(!aY(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=d.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(d.hasAttribute("data-tabindex")&&t(d),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of nM(d,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return d.addEventListener("focusin",r,!0),d.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),d.removeEventListener("focusin",r,!0),d.removeEventListener("focusout",r,!0)}},[d,e]),s={...s=ne(s,t=>{if(t=(0,n.jsx)(iz.Provider,{value:d||c,children:t}),!i)return t;if(!d)return(0,n.jsx)("span",{ref:u,id:s.id,style:{position:"fixed"},hidden:!0});t=(0,n.jsxs)(n.Fragment,{children:[e&&d&&(0,n.jsx)(iW,{ref:g,"data-focus-trap":s.id,className:"__focus-trap-inner-before",onFocus:e=>{aY(e,d)?iX(nD()):iX(p.current)}}),t,e&&d&&(0,n.jsx)(iW,{ref:v,"data-focus-trap":s.id,className:"__focus-trap-inner-after",onFocus:e=>{aY(e,d)?iX(nk()):iX(y.current)}})]}),d&&(t=(0,i_.createPortal)(t,d));let r=(0,n.jsxs)(n.Fragment,{children:[e&&d&&(0,n.jsx)(iW,{ref:p,"data-focus-trap":s.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==y.current&&aY(e,d)?iX(g.current):iX(nk())}}),e&&(0,n.jsx)("span",{"aria-owns":null==d?void 0:d.id,style:{position:"fixed"}}),e&&d&&(0,n.jsx)(iW,{ref:y,"data-focus-trap":s.id,className:"__focus-trap-outer-after",onFocus:e=>{if(aY(e,d))iX(v.current);else{let e=nD();if(e===g.current)return void requestAnimationFrame(()=>{var e;return null==(e=nD())?void 0:e.focus()});iX(e)}}})]});return h&&e&&(r=(0,i_.createPortal)(r,h)),(0,n.jsxs)(n.Fragment,{children:[r,t]})},[d,c,i,s.id,e,h]),ref:u}});nl(function(e){return nc("div",iY(e))});var iZ=(0,o.createContext)(0);function i$({level:e,children:t}){let r=(0,o.useContext)(iZ),a=Math.max(Math.min(e||r+1,6),1);return(0,n.jsx)(iZ.Provider,{value:a,children:t})}var i0=nd(function({autoFocusOnShow:e=!0,...t}){return ne(t,t=>(0,n.jsx)(nC.Provider,{value:e,children:t}),[e])});nl(function(e){return nc("div",i0(e))});var i1=new WeakMap;function i2(e,t,r){i1.has(e)||i1.set(e,new Map);let a=i1.get(e),n=a.get(t);if(!n)return a.set(t,r()),()=>{var e;null==(e=a.get(t))||e(),a.delete(t)};let i=r(),o=()=>{i(),n(),a.delete(t)};return a.set(t,o),()=>{a.get(t)===o&&(i(),a.set(t,n))}}function i3(e,t,r){return i2(e,t,()=>{let a=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==a?e.removeAttribute(t):e.setAttribute(t,a)}})}function i9(e,t,r){return i2(e,t,()=>{let a=t in e,n=e[t];return e[t]=r,()=>{a?e[t]=n:delete e[t]}})}function i5(e,t){return e?i2(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var i8=["SCRIPT","STYLE"];function i4(e){return`__ariakit-dialog-snapshot-${e}`}function i6(e,t,r,a){for(let n of t){if(!(null==n?void 0:n.isConnected))continue;let i=t.some(e=>!!e&&e!==n&&e.contains(n)),o=av(n),s=n;for(;n.parentElement&&n!==o.body;){if(null==a||a(n.parentElement,s),!i)for(let a of n.parentElement.children)(function(e,t,r){return!i8.includes(t.tagName)&&!!function(e,t){let r=av(t),a=i4(e);if(!r.body[a])return!0;for(;;){if(t===r.body)return!1;if(t[a])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&aF(t,e))})(e,a,t)&&r(a,s);n=n.parentElement}}}function i7(e,...t){if(!e)return!1;let r=e.getAttribute("data-backdrop");return null!=r&&(""===r||"true"===r||!t.length||t.some(e=>r===e))}function oe(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function ot(e,t=""){return aL(i9(e,oe("",!0),!0),i9(e,oe(t,!0),!0))}function or(e,t){if(e[oe(t,!0)])return!0;let r=oe(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function oa(e,t){let r=[],a=t.map(e=>null==e?void 0:e.id);return i6(e,t,t=>{i7(t,...a)||r.unshift(function(e,t=""){return aL(i9(e,oe(),!0),i9(e,oe(t),!0))}(t,e))},(t,a)=>{a.hasAttribute("data-dialog")&&a.id!==e||r.unshift(ot(t,e))}),()=>{for(let e of r)e()}}function on({store:e,type:t,listener:r,capture:a,domReady:n}){let i=a9(r),s=iw(e,"open"),l=(0,o.useRef)(!1);a3(()=>{if(!s||!n)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{l.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,s,n]),(0,o.useEffect)(()=>{if(s)return a$(t,t=>{let{contentElement:r,disclosureElement:a}=e.getState(),n=t.target;!r||!n||!(!("HTML"===n.tagName||aF(av(n).body,n))||aF(r,n)||function(e,t){if(!e)return!1;if(aF(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=av(e).getElementById(r);if(t)return aF(e,t)}return!1}(a,n)||n.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(t,r))&&(!l.current||or(n,r.id))&&(n&&n[nG]||i(t))},a)},[s,a])}function oi(e,t){return"function"==typeof e?e(t):!!e}var oo=(0,o.createContext)({});function os(){return"inert"in HTMLElement.prototype}function ol(e,t){if(!("style"in e))return aP;if(os())return i9(e,"inert",!0);let r=nM(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&aF(t,e)))return aP;let r=i2(e,"focus",()=>(e.focus=aP,()=>{delete e.focus}));return aL(i3(e,"tabindex","-1"),r)});return aL(...r,i3(e,"aria-hidden","true"),i5(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function ou(e={}){let t=ip(e.store,im(e.disclosure,["contentElement","disclosureElement"]));ig(e,t);let r=null==t?void 0:t.getState(),a=aN(e.open,null==r?void 0:r.open,e.defaultOpen,!1),n=aN(e.animated,null==r?void 0:r.animated,!1),i=is({open:a,animated:n,animating:!!n&&a,mounted:a,contentElement:aN(null==r?void 0:r.contentElement,null),disclosureElement:aN(null==r?void 0:r.disclosureElement,null)},t);return il(i,()=>id(i,["animated","animating"],e=>{e.animated||i.setState("animating",!1)})),il(i,()=>ic(i,["open"],()=>{i.getState().animated&&i.setState("animating",!0)})),il(i,()=>id(i,["open","animating"],e=>{i.setState("mounted",e.open||e.animating)})),{...i,disclosure:e.disclosure,setOpen:e=>i.setState("open",e),show:()=>i.setState("open",!0),hide:()=>i.setState("open",!1),toggle:()=>i.setState("open",e=>!e),stopAnimation:()=>i.setState("animating",!1),setContentElement:e=>i.setState("contentElement",e),setDisclosureElement:e=>i.setState("disclosureElement",e)}}function oc(e,t,r){return a4(t,[r.store,r.disclosure]),iT(e,r,"open","setOpen"),iT(e,r,"mounted","setMounted"),iT(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}nd(function(e){return e});var od=nl(function(e){return nc("div",e)});function of({store:e,backdrop:t,alwaysVisible:r,hidden:a}){let i=(0,o.useRef)(null),s=function(e={}){let[t,r]=iR(ou,e);return oc(t,r,e)}({disclosure:e}),l=iw(e,"contentElement");(0,o.useEffect)(()=>{let e=i.current;!e||l&&(e.style.zIndex=getComputedStyle(l).zIndex)},[l]),a3(()=>{let e=null==l?void 0:l.id;if(!e)return;let t=i.current;if(t)return ot(t,e)},[l]);let u=iN({ref:i,store:s,role:"presentation","data-backdrop":(null==l?void 0:l.id)||"",alwaysVisible:r,hidden:null!=a?a:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!t)return null;if((0,o.isValidElement)(t))return(0,n.jsx)(od,{...u,render:t});let c="boolean"!=typeof t?t:"div";return(0,n.jsx)(od,{...u,render:(0,n.jsx)(c,{})})}function oh(e={}){return ou(e)}Object.assign(od,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=nl(function(e){return nc(t,e)}),e),{}));var om=az();function op(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?nS(r)?r:null:r:null}var og=nd(function({store:e,open:t,onClose:r,focusable:a=!0,modal:i=!0,portal:s=!!i,backdrop:l=!!i,hideOnEscape:u=!0,hideOnInteractOutside:c=!0,getPersistentElements:d,preventBodyScroll:f=!!i,autoFocusOnShow:h=!0,autoFocusOnHide:m=!0,initialFocus:p,finalFocus:g,unmountOnHide:v,unstable_treeSnapshotKey:y,...A}){var F;let b,C,B,S=nX(),x=(0,o.useRef)(null),E=function(e={}){let[t,r]=iR(oh,e);return oc(t,r,e)}({store:e||S,open:t,setOpen(e){if(e)return;let t=x.current;if(!t)return;let a=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(a),a.defaultPrevented&&E.setOpen(!0)}}),{portalRef:M,domReady:D}=nt(s,A.portalRef),k=A.preserveTabOrder,w=iw(E,e=>k&&!i&&e.mounted),I=a8(A.id),T=iw(E,"open"),R=iw(E,"mounted"),P=iw(E,"contentElement"),G=iH(R,A.hidden,A.alwaysVisible);b=function({attribute:e,contentId:t,contentElement:r,enabled:a}){let[n,i]=a6(),s=(0,o.useCallback)(()=>{if(!a||!r)return!1;let{body:n}=av(r),i=n.getAttribute(e);return!i||i===t},[n,a,r,e,t]);return(0,o.useEffect)(()=>{if(!a||!t||!r)return;let{body:n}=av(r);if(s())return n.setAttribute(e,t),()=>n.removeAttribute(e);let o=new MutationObserver(()=>(0,i_.flushSync)(i));return o.observe(n,{attributeFilter:[e]}),()=>o.disconnect()},[n,a,t,r,s,e]),s}({attribute:"data-dialog-prevent-body-scroll",contentElement:P,contentId:I,enabled:f&&!G}),(0,o.useEffect)(()=>{var e,t;if(!b()||!P)return;let r=av(P),a=ay(P),{documentElement:n,body:i}=r,o=n.style.getPropertyValue("--scrollbar-width"),s=o?Number.parseInt(o,10):a.innerWidth-n.clientWidth,l=Math.round(n.getBoundingClientRect().left)+n.scrollLeft?"paddingLeft":"paddingRight",u=aV()&&!(ag&&navigator.platform.startsWith("Mac")&&!aK());return aL((e="--scrollbar-width",t=`${s}px`,n?i2(n,e,()=>{let r=n.style.getPropertyValue(e);return n.style.setProperty(e,t),()=>{r?n.style.setProperty(e,r):n.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:n,visualViewport:o}=a,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=i5(i,{position:"fixed",overflow:"hidden",top:`${-(n-Math.floor(c))}px`,left:`${-(r-Math.floor(u))}px`,right:"0",[l]:`${s}px`});return()=>{d(),a.scrollTo({left:r,top:n,behavior:"instant"})}})():i5(i,{overflow:"hidden",[l]:`${s}px`}))},[b,P]),F=iw(E,"open"),C=(0,o.useRef)(),(0,o.useEffect)(()=>{if(!F){C.current=null;return}return a$("mousedown",e=>{C.current=e.target},!0)},[F]),on({...B={store:E,domReady:D,capture:!0},type:"click",listener:e=>{let{contentElement:t}=E.getState(),r=C.current;r&&aS(r)&&or(r,null==t?void 0:t.id)&&oi(c,e)&&E.hide()}}),on({...B,type:"focusin",listener:e=>{let{contentElement:t}=E.getState();!t||e.target===av(t)||oi(c,e)&&E.hide()}}),on({...B,type:"contextmenu",listener:e=>{oi(c,e)&&E.hide()}});let{wrapElement:L,nestedDialogs:j}=function(e){let t=(0,o.useContext)(oo),[r,a]=(0,o.useState)([]),i=(0,o.useCallback)(e=>{var r;return a(t=>[...t,e]),aL(null==(r=t.add)?void 0:r.call(t,e),()=>{a(t=>t.filter(t=>t!==e))})},[t]);a3(()=>id(e,["open","contentElement"],r=>{var a;if(r.open&&r.contentElement)return null==(a=t.add)?void 0:a.call(t,e)}),[e,t]);let s=(0,o.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,o.useCallback)(e=>(0,n.jsx)(oo.Provider,{value:s,children:e}),[s]),nestedDialogs:r}}(E);A=ne(A,L,[L]),a3(()=>{if(!T)return;let e=x.current,t=aA(e,!0);!t||"BODY"===t.tagName||e&&aF(e,t)||E.setDisclosureElement(t)},[E,T]),om&&(0,o.useEffect)(()=>{if(!R)return;let{disclosureElement:e}=E.getState();if(!e||!aC(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),aZ(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||nT(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[E,R]),(0,o.useEffect)(()=>{if(!R||!D)return;let e=x.current;if(!e)return;let t=ay(e),r=t.visualViewport||t,a=()=>{var r,a;let n=null!=(a=null==(r=t.visualViewport)?void 0:r.height)?a:t.innerHeight;e.style.setProperty("--dialog-viewport-height",`${n}px`)};return a(),r.addEventListener("resize",a),()=>{r.removeEventListener("resize",a)}},[R,D]),(0,o.useEffect)(()=>{if(!i||!R||!D)return;let e=x.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=E.hide,(r=av(e).createElement("button")).type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[E,i,R,D]),a3(()=>{if(!os()||T||!R||!D)return;let e=x.current;if(e)return ol(e)},[T,R,D]);let _=T&&D;a3(()=>{if(I&&_)return function(e,t){let{body:r}=av(t[0]),a=[];return i6(e,t,t=>{a.push(i9(t,i4(e),!0))}),aL(i9(r,i4(e),!0),()=>{for(let e of a)e()})}(I,[x.current])},[I,_,y]);let O=a9(d);a3(()=>{if(!I||!_)return;let{disclosureElement:e}=E.getState(),t=[x.current,...O()||[],...j.map(e=>e.getState().contentElement)];if(i){let e,r;return aL(oa(I,t),(e=[],r=t.map(e=>null==e?void 0:e.id),i6(I,t,a=>{i7(a,...r)||!function(e,...t){if(!e)return!1;let r=e.getAttribute("data-focus-trap");return null!=r&&(!t.length||""!==r&&t.some(e=>r===e))}(a,...r)&&e.unshift(ol(a,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&aF(e,r))||e.unshift(i3(r,"role","none"))}),()=>{for(let t of e)t()}))}return oa(I,[e,...t])},[I,E,_,O,j,i,y]);let U=!!h,H=a7(h),[N,J]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!T||!U||!D||!(null==P?void 0:P.isConnected))return;let e=op(p,!0)||P.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[a]=nM(e,t,r);return a||null}(P,!0,s&&w)||P,t=nS(e);H(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!om||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[T,U,D,P,p,s,w,H]);let K=!!m,V=a7(m),[z,q]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(T)return q(!0),()=>q(!1)},[T]);let Q=(0,o.useCallback)((e,t=!0)=>{let r,{disclosureElement:a}=E.getState();if(!(!(r=aA())||e&&aF(e,r))&&nS(r))return;let n=op(g)||a;if(null==n?void 0:n.id){let e=av(n),t=`[aria-activedescendant="${n.id}"]`,r=e.querySelector(t);r&&(n=r)}if(n&&!nS(n)){let e=n.closest("[data-dialog]");if(null==e?void 0:e.id){let t=av(e),r=`[aria-controls~="${e.id}"]`,a=t.querySelector(r);a&&(n=a)}}let i=n&&nS(n);!i&&t?requestAnimationFrame(()=>Q(e,!1)):!V(i?n:null)||i&&(null==n||n.focus({preventScroll:!0}))},[E,g,V]),W=(0,o.useRef)(!1);a3(()=>{if(T||!z||!K)return;let e=x.current;W.current=!0,Q(e)},[T,z,D,K,Q]),(0,o.useEffect)(()=>{if(!z||!K)return;let e=x.current;return()=>{if(W.current){W.current=!1;return}Q(e)}},[z,K,Q]);let X=a7(u);(0,o.useEffect)(()=>{if(D&&R)return a$("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=x.current;if(!t||or(t))return;let r=e.target;if(!r)return;let{disclosureElement:a}=E.getState();!("BODY"===r.tagName||aF(t,r)||!a||aF(a,r))||X(e)&&E.hide()},!0)},[E,D,R,X]);let Y=(A=ne(A,e=>(0,n.jsx)(i$,{level:i?1:void 0,children:e}),[i])).hidden,Z=A.alwaysVisible;A=ne(A,e=>l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(of,{store:E,backdrop:l,hidden:Y,alwaysVisible:Z}),e]}):e,[E,l,Y,Z]);let[$,ee]=(0,o.useState)(),[et,er]=(0,o.useState)();return A=i0({...A={id:I,"data-dialog":"",role:"dialog",tabIndex:a?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...A=ne(A,e=>(0,n.jsx)(nZ,{value:E,children:(0,n.jsx)(n$.Provider,{value:ee,children:(0,n.jsx)(n0.Provider,{value:er,children:e})})}),[E]),ref:a5(x,A.ref)},autoFocusOnShow:N}),A=iY({portal:s,...A=nN({...A=iN({store:E,...A}),focusable:a}),portalRef:M,preserveTabOrder:w})});function ov(e,t=nX){return nl(function(r){let a=t();return iw(r.store||a,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,n.jsx)(e,{...r}):null})}ov(nl(function(e){return nc("div",og(e))}),nX);let oy=Math.min,oA=Math.max,oF=Math.round,ob=Math.floor,oC=e=>({x:e,y:e}),oB={left:"right",right:"left",bottom:"top",top:"bottom"},oS={start:"end",end:"start"};function ox(e,t){return"function"==typeof e?e(t):e}function oE(e){return e.split("-")[0]}function oM(e){return e.split("-")[1]}function oD(e){return"x"===e?"y":"x"}function ok(e){return"y"===e?"height":"width"}let ow=new Set(["top","bottom"]);function oI(e){return ow.has(oE(e))?"y":"x"}function oT(e){return e.replace(/start|end/g,e=>oS[e])}let oR=["left","right"],oP=["right","left"],oG=["top","bottom"],oL=["bottom","top"];function oj(e){return e.replace(/left|right|bottom|top/g,e=>oB[e])}function o_(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oO(e){let{x:t,y:r,width:a,height:n}=e;return{width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}function oU(e,t,r){let a,{reference:n,floating:i}=e,o=oI(t),s=oD(oI(t)),l=ok(s),u=oE(t),c="y"===o,d=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,h=n[l]/2-i[l]/2;switch(u){case"top":a={x:d,y:n.y-i.height};break;case"bottom":a={x:d,y:n.y+n.height};break;case"right":a={x:n.x+n.width,y:f};break;case"left":a={x:n.x-i.width,y:f};break;default:a={x:n.x,y:n.y}}switch(oM(t)){case"start":a[s]-=h*(r&&c?-1:1);break;case"end":a[s]+=h*(r&&c?-1:1)}return a}let oH=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:i=[],platform:o}=r,s=i.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:n}),{x:c,y:d}=oU(u,a,l),f=a,h={},m=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let o9=["transform","translate","scale","rotate","perspective"],o5=["transform","translate","scale","rotate","perspective","filter"],o8=["paint","layout","strict","content"];function o4(e){let t=o6(),r=oX(e)?st(e):e;return o9.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||o5.some(e=>(r.willChange||"").includes(e))||o8.some(e=>(r.contain||"").includes(e))}function o6(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let o7=new Set(["html","body","#document"]);function se(e){return o7.has(oz(e))}function st(e){return oq(e).getComputedStyle(e)}function sr(e){return oX(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sa(e){if("html"===oz(e))return e;let t=e.assignedSlot||e.parentNode||oZ(e)&&e.host||oQ(e);return oZ(t)?t.host:t}function sn(e,t,r){var a;void 0===t&&(t=[]),void 0===r&&(r=!0);let n=function e(t){let r=sa(t);return se(r)?t.ownerDocument?t.ownerDocument.body:t.body:oY(r)&&o0(r)?r:e(r)}(e),i=n===(null==(a=e.ownerDocument)?void 0:a.body),o=oq(n);if(i){let e=si(o);return t.concat(o,o.visualViewport||[],o0(n)?n:[],e&&r?sn(e):[])}return t.concat(n,sn(n,[],r))}function si(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function so(e){let t=st(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=oY(e),i=n?e.offsetWidth:r,o=n?e.offsetHeight:a,s=oF(r)!==i||oF(a)!==o;return s&&(r=i,a=o),{width:r,height:a,$:s}}function ss(e){return oX(e)?e:e.contextElement}function sl(e){let t=ss(e);if(!oY(t))return oC(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:i}=so(t),o=(i?oF(r.width):r.width)/a,s=(i?oF(r.height):r.height)/n;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let su=oC(0);function sc(e){let t=oq(e);return o6()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:su}function sd(e,t,r,a){var n;void 0===t&&(t=!1),void 0===r&&(r=!1);let i=e.getBoundingClientRect(),o=ss(e),s=oC(1);t&&(a?oX(a)&&(s=sl(a)):s=sl(e));let l=(void 0===(n=r)&&(n=!1),a&&(!n||a===oq(o))&&n)?sc(o):oC(0),u=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){let e=oq(o),t=a&&oX(a)?oq(a):a,r=e,n=si(r);for(;n&&a&&t!==r;){let e=sl(n),t=n.getBoundingClientRect(),a=st(n),i=t.left+(n.clientLeft+parseFloat(a.paddingLeft))*e.x,o=t.top+(n.clientTop+parseFloat(a.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=i,c+=o,n=si(r=oq(n))}}return oO({width:d,height:f,x:u,y:c})}function sf(e,t){let r=sr(e).scrollLeft;return t?t.left+r:sd(oQ(e)).left+r}function sh(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-sf(e,r),y:r.top+t.scrollTop}}let sm=new Set(["absolute","fixed"]);function sp(e,t,r){var a;let n;if("viewport"===t)n=function(e,t){let r=oq(e),a=oQ(e),n=r.visualViewport,i=a.clientWidth,o=a.clientHeight,s=0,l=0;if(n){i=n.width,o=n.height;let e=o6();(!e||e&&"fixed"===t)&&(s=n.offsetLeft,l=n.offsetTop)}let u=sf(a);if(u<=0){let e=a.ownerDocument,t=e.body,r=getComputedStyle(t),n="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(a.clientWidth-t.clientWidth-n);o<=25&&(i-=o)}else u<=25&&(i+=u);return{width:i,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,i,o,s,l,u;a=oQ(e),t=oQ(a),r=sr(a),i=a.ownerDocument.body,o=oA(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=oA(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),l=-r.scrollLeft+sf(a),u=-r.scrollTop,"rtl"===st(i).direction&&(l+=oA(t.clientWidth,i.clientWidth)-o),n={width:o,height:s,x:l,y:u}}else if(oX(t)){let e,a,i,o,s,l;a=(e=sd(t,!0,"fixed"===r)).top+t.clientTop,i=e.left+t.clientLeft,o=oY(t)?sl(t):oC(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,n={width:s,height:l,x:i*o.x,y:a*o.y}}else{let r=sc(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oO(n)}function sg(e){return"static"===st(e).position}function sv(e,t){if(!oY(e)||"fixed"===st(e).position)return null;if(t)return t(e);let r=e.offsetParent;return oQ(e)===r&&(r=r.ownerDocument.body),r}function sy(e,t){var r;let a=oq(e);if(o3(e))return a;if(!oY(e)){let t=sa(e);for(;t&&!se(t);){if(oX(t)&&!sg(t))return t;t=sa(t)}return a}let n=sv(e,t);for(;n&&(r=n,o1.has(oz(r)))&&sg(n);)n=sv(n,t);return n&&se(n)&&sg(n)&&!o4(n)?a:n||function(e){let t=sa(e);for(;oY(t)&&!se(t);){if(o4(t))return t;if(o3(t))break;t=sa(t)}return null}(e)||a}let sA=async function(e){let t=this.getOffsetParent||sy,r=this.getDimensions,a=await r(e.floating);return{reference:function(e,t,r){let a=oY(t),n=oQ(t),i="fixed"===r,o=sd(e,!0,i,t),s={scrollLeft:0,scrollTop:0},l=oC(0);if(a||!a&&!i)if(("body"!==oz(t)||o0(n))&&(s=sr(t)),a){let e=sd(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else n&&(l.x=sf(n));i&&!a&&n&&(l.x=sf(n));let u=!n||a||i?oC(0):sh(n,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}},sF={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,i="fixed"===n,o=oQ(a),s=!!t&&o3(t.floating);if(a===o||s&&i)return r;let l={scrollLeft:0,scrollTop:0},u=oC(1),c=oC(0),d=oY(a);if((d||!d&&!i)&&(("body"!==oz(a)||o0(o))&&(l=sr(a)),oY(a))){let e=sd(a);u=sl(a),c.x=e.x+a.clientLeft,c.y=e.y+a.clientTop}let f=!o||d||i?oC(0):sh(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-l.scrollTop*u.y+c.y+f.y}},getDocumentElement:oQ,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,i=[..."clippingAncestors"===r?o3(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let a=sn(e,[],!1).filter(e=>oX(e)&&"body"!==oz(e)),n=null,i="fixed"===st(e).position,o=i?sa(e):e;for(;oX(o)&&!se(o);){let t=st(o),r=o4(o);r||"fixed"!==t.position||(n=null),(i?!r&&!n:!r&&"static"===t.position&&!!n&&sm.has(n.position)||o0(o)&&!r&&function e(t,r){let a=sa(t);return!(a===r||!oX(a)||se(a))&&("fixed"===st(a).position||e(a,r))}(e,o))?a=a.filter(e=>e!==o):n=t,o=sa(o)}return t.set(e,a),a}(t,this._c):[].concat(r),a],o=i[0],s=i.reduce((e,r)=>{let a=sp(t,r,n);return e.top=oA(a.top,e.top),e.right=oy(a.right,e.right),e.bottom=oy(a.bottom,e.bottom),e.left=oA(a.left,e.left),e},sp(t,o,n));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:sy,getElementRects:sA,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=so(e);return{width:t,height:r}},getScale:sl,isElement:oX,isRTL:function(e){return"rtl"===st(e).direction}};function sb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sC(e=0,t=0,r=0,a=0){if("function"==typeof DOMRect)return new DOMRect(e,t,r,a);let n={x:e,y:t,width:r,height:a,top:t,right:e+r,bottom:t+a,left:e};return{...n,toJSON:()=>n}}function sB(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function sS(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var sx=nd(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:a=!0,autoFocusOnShow:i=!0,wrapperProps:s,fixed:l=!1,flip:u=!0,shift:c=0,slide:d=!0,overlap:f=!1,sameWidth:h=!1,fitViewport:m=!1,gutter:p,arrowPadding:g=4,overflowPadding:v=8,getAnchorRect:y,updatePosition:A,...F}){let b=n2();a_(e=e||b,!1);let C=e.useState("arrowElement"),B=e.useState("anchorElement"),S=e.useState("disclosureElement"),x=e.useState("popoverElement"),E=e.useState("contentElement"),M=e.useState("placement"),D=e.useState("mounted"),k=e.useState("rendered"),w=(0,o.useRef)(null),[I,T]=(0,o.useState)(!1),{portalRef:R,domReady:P}=nt(r,F.portalRef),G=a9(y),L=a9(A),j=!!A;a3(()=>{if(!(null==x?void 0:x.isConnected))return;x.style.setProperty("--popover-overflow-padding",`${v}px`);let t={contextElement:B||void 0,getBoundingClientRect:()=>{let e=null==G?void 0:G(B);return e||!B?function(e){if(!e)return sC();let{x:t,y:r,width:a,height:n}=e;return sC(t,r,a,n)}(e):B.getBoundingClientRect()}},r=async()=>{var r,a,n,i,o;let s,y,A;if(!D)return;C||(w.current=w.current||document.createElement("div"));let F=C||w.current,b=[(r={gutter:p,shift:c},void 0===(a=({placement:e})=>{var t;let a=((null==F?void 0:F.clientHeight)||0)/2,n="number"==typeof r.gutter?r.gutter+a:null!=(t=r.gutter)?t:a;return{crossAxis:e.split("-")[1]?void 0:r.shift,mainAxis:n,alignmentAxis:r.shift}})&&(a=0),{name:"offset",options:a,async fn(e){var t,r;let{x:n,y:i,placement:o,middlewareData:s}=e,l=await oK(e,a);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:i+l.y,data:{...l,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return a_(!r||r.every(sB),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,a,n,i,o,s,l,u;let c,d,f,{placement:h,middlewareData:m,rects:p,initialPlacement:g,platform:v,elements:y}=e,{mainAxis:A=!0,crossAxis:F=!0,fallbackPlacements:b,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:B="none",flipAlignment:S=!0,...x}=ox(t,e);if(null!=(r=m.arrow)&&r.alignmentOffset)return{};let E=oE(h),M=oI(g),D=oE(g)===g,k=await (null==v.isRTL?void 0:v.isRTL(y.floating)),w=b||(D||!S?[oj(g)]:(c=oj(g),[oT(g),c,oT(c)])),I="none"!==B;!b&&I&&w.push(...(d=oM(g),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?oP:oR;return t?oR:oP;case"left":case"right":return t?oG:oL;default:return[]}}(oE(g),"start"===B,k),d&&(f=f.map(e=>e+"-"+d),S&&(f=f.concat(f.map(oT)))),f));let T=[g,...w],R=await oN(e,x),P=[],G=(null==(a=m.flip)?void 0:a.overflows)||[];if(A&&P.push(R[E]),F){let e,t,r,a,n=(s=h,l=p,void 0===(u=k)&&(u=!1),e=oM(s),r=ok(t=oD(oI(s))),a="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(a=oj(a)),[a,oj(a)]);P.push(R[n[0]],R[n[1]])}if(G=[...G,{placement:h,overflows:P}],!P.every(e=>e<=0)){let e=((null==(n=m.flip)?void 0:n.index)||0)+1,t=T[e];if(t&&("alignment"!==F||M===oI(t)||G.every(e=>oI(e.placement)!==M||e.overflows[0]>0)))return{data:{index:e,overflows:G},reset:{placement:t}};let r=null==(i=G.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!r)switch(C){case"bestFit":{let e=null==(o=G.filter(e=>{if(I){let t=oI(e.placement);return t===M||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=g}if(h!==r)return{reset:{placement:r}}}return{}}}}({flip:u,overflowPadding:v}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:a,placement:n,rects:i,middlewareData:o}=e,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=ox(t,e),c={x:r,y:a},d=oI(n),f=oD(d),h=c[f],m=c[d],p=ox(s,e),g="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){let e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+g.mainAxis,r=i.reference[f]+i.reference[e]-g.mainAxis;hr&&(h=r)}if(u){var v,y;let e="y"===f?"width":"height",t=oJ.has(oE(n)),r=i.reference[d]-i.floating[e]+(t&&(null==(v=o.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),a=i.reference[d]+i.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);ma&&(m=a)}return{[f]:h,[d]:m}}})},async fn(e){let{x:t,y:a,placement:n}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=ox(r,e),u={x:t,y:a},c=await oN(e,l),d=oI(oE(n)),f=oD(d),h=u[f],m=u[d];if(i){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+c[e],a=h-c[t];h=oA(r,oy(h,a))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=m+c[e],a=m-c[t];m=oA(r,oy(m,a))}let p=s.fn({...e,[f]:h,[d]:m});return{...p,data:{x:p.x-t,y:p.y-a,enabled:{[f]:i,[d]:o}}}}}}}({slide:d,shift:c,overlap:f,overflowPadding:v}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:a,placement:n,rects:i,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=ox(r,e)||{};if(null==u)return{};let d=o_(c),f={x:t,y:a},h=oD(oI(n)),m=ok(h),p=await o.getDimensions(u),g="y"===h,v=g?"clientHeight":"clientWidth",y=i.reference[m]+i.reference[h]-f[h]-i.floating[m],A=f[h]-i.reference[h],F=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),b=F?F[v]:0;b&&await (null==o.isElement?void 0:o.isElement(F))||(b=s.floating[v]||i.floating[m]);let C=b/2-p[m]/2-1,B=oy(d[g?"top":"left"],C),S=oy(d[g?"bottom":"right"],C),x=b-p[m]-S,E=b/2-p[m]/2+(y/2-A/2),M=oA(B,oy(E,x)),D=!l.arrow&&null!=oM(n)&&E!==M&&i.reference[m]/2-(E{},...d}=ox(i,e),f=await oN(e,d),h=oE(o),m=oM(o),p="y"===oI(o),{width:g,height:v}=s.floating;"top"===h||"bottom"===h?(a=h,n=m===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(n=h,a="end"===m?"top":"bottom");let y=v-f.top-f.bottom,A=g-f.left-f.right,F=oy(v-f[a],y),b=oy(g-f[n],A),C=!e.middlewareData.shift,B=F,S=b;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(S=A),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(B=y),C&&!m){let e=oA(f.left,0),t=oA(f.right,0),r=oA(f.top,0),a=oA(f.bottom,0);p?S=g-2*(0!==e||0!==t?e+t:oA(f.left,f.right)):B=v-2*(0!==r||0!==a?r+a:oA(f.top,f.bottom))}await c({...e,availableWidth:S,availableHeight:B});let x=await l.getDimensions(u.floating);return g!==x.width||v!==x.height?{reset:{rects:!0}}:{}}}],B=await (o={placement:M,strategy:l?"fixed":"absolute",middleware:b},s=new Map,A={...(y={platform:sF,...o}).platform,_c:s},oH(t,x,{...y,platform:A}));null==e||e.setState("currentPlacement",B.placement),T(!0);let S=sS(B.x),E=sS(B.y);if(Object.assign(x.style,{top:"0",left:"0",transform:`translate3d(${S}px,${E}px,0)`}),F&&B.middlewareData.arrow){let{x:e,y:t}=B.middlewareData.arrow,r=B.placement.split("-")[0],a=F.clientWidth/2,n=F.clientHeight/2,i=null!=e?e+a:-a,o=null!=t?t+n:-n;x.style.setProperty("--popover-transform-origin",{top:`${i}px calc(100% + ${n}px)`,bottom:`${i}px ${-n}px`,left:`calc(100% + ${a}px) ${o}px`,right:`${-a}px ${o}px`}[r]),Object.assign(F.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[r]:"100%"})}},a=function(e,t,r,a){let n;void 0===a&&(a={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=a,c=ss(e),d=i||o?[...c?sn(c):[],...sn(t)]:[];d.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,a=null,n=oQ(e);function i(){var e;clearTimeout(r),null==(e=a)||e.disconnect(),a=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(s||t(),!f||!h)return;let m={rootMargin:-ob(d)+"px "+-ob(n.clientWidth-(c+f))+"px "+-ob(n.clientHeight-(d+h))+"px "+-ob(c)+"px",threshold:oA(0,oy(1,l))||1},p=!0;function g(t){let a=t[0].intersectionRatio;if(a!==l){if(!p)return o();a?o(!1,a):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==a||sb(u,e.getBoundingClientRect())||o(),p=!1}try{a=new IntersectionObserver(g,{...m,root:n.ownerDocument})}catch(e){a=new IntersectionObserver(g,m)}a.observe(e)}(!0),i}(c,r):null,h=-1,m=null;s&&(m=new ResizeObserver(e=>{let[a]=e;a&&a.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),m.observe(t));let p=u?sd(e):null;return u&&function t(){let a=sd(e);p&&!sb(p,a)&&r(),p=a,n=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(n)}}(t,x,async()=>{j?(await L({updatePosition:r}),T(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{T(!1),a()}},[e,k,x,C,B,x,M,D,P,l,u,c,d,f,h,m,p,g,v,G,j,L]),a3(()=>{if(!D||!P||!(null==x?void 0:x.isConnected)||!(null==E?void 0:E.isConnected))return;let e=()=>{x.style.zIndex=getComputedStyle(E).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[D,P,x,E]);let _=l?"fixed":"absolute";return F=ne(F,t=>(0,n.jsx)("div",{...s,style:{position:_,top:0,left:0,width:"max-content",...null==s?void 0:s.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,_,s]),F={"data-placing":!I||void 0,...F=ne(F,t=>(0,n.jsx)(n9,{value:e,children:t}),[e]),style:{position:"relative",...F.style}},F=og({store:e,modal:t,portal:r,preserveTabOrder:a,preserveTabOrderAnchor:S||B,autoFocusOnShow:I&&i,...F,portalRef:R})});ov(nl(function(e){return nc("div",sx(e))}),n2);var sE=nd(function({store:e,modal:t,tabIndex:r,alwaysVisible:a,autoFocusOnHide:n=!0,hideOnInteractOutside:i=!0,...s}){let l=ie();a_(e=e||l,!1);let u=e.useState("baseElement"),c=(0,o.useRef)(!1),d=iw(e.tag,e=>null==e?void 0:e.renderedItems.length);return s=iK({store:e,alwaysVisible:a,...s}),s=sx({store:e,modal:t,alwaysVisible:a,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...s,getPersistentElements(){var r;let a=(null==(r=s.getPersistentElements)?void 0:r.call(s))||[];if(!t||!e)return a;let{contentElement:n,baseElement:i}=e.getState();if(!i)return a;let o=av(i),l=[];if((null==n?void 0:n.id)&&l.push(`[aria-controls~="${n.id}"]`),(null==i?void 0:i.id)&&l.push(`[aria-controls~="${i.id}"]`),!l.length)return[...a,i];let u=l.join(",");return[...a,...o.querySelectorAll(u)]},autoFocusOnHide:e=>!aO(n,e)&&(!c.current||(c.current=!1,!1)),hideOnInteractOutside(t){var r,a;let n=null==e?void 0:e.getState(),o=null==(r=null==n?void 0:n.contentElement)?void 0:r.id,s=null==(a=null==n?void 0:n.baseElement)?void 0:a.id;if(function(e,...t){if(!e)return!1;if("id"in e){let r=t.filter(Boolean).map(e=>`[aria-controls~="${e}"]`).join(", ");return!!r&&e.matches(r)}return!1}(t.target,o,s))return!1;let l="function"==typeof i?i(t):i;return l&&(c.current="click"===t.type),l}})}),sM=ov(nl(function(e){return nc("div",sE(e))}),ie);(0,o.createContext)(null),(0,o.createContext)(null);var sD=nf([ny],[nA]),sk=sD.useContext;sD.useScopedContext,sD.useProviderContext,sD.ContextProvider,sD.ScopedContextProvider;var sw={id:null};function sI(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function sT(e,t){return e.filter(e=>e.rowId===t)}function sR(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function sP(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var sG=az()&&aK();function sL({tag:e,...t}={}){let r=ip(t.store,function(e,...t){if(e)return io(e,"pick")(...t)}(e,["value","rtl"]));ig(t,r);let a=null==e?void 0:e.getState(),n=null==r?void 0:r.getState(),i=aN(t.activeId,null==n?void 0:n.activeId,t.defaultActiveId,null),o=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),a=function(e={}){var t,r;ig(e,e.store);let a=null==(t=e.store)?void 0:t.getState(),n=aN(e.items,null==a?void 0:a.items,e.defaultItems,[]),i=new Map(n.map(e=>[e.id,e])),o={items:n,renderedItems:aN(null==a?void 0:a.renderedItems,[])},s=null==(r=e.store)?void 0:r.__unstablePrivateStore,l=is({items:n,renderedItems:o.renderedItems},s),u=is(o,e.store),c=e=>{var t;let r,a,n=(t=e=>e.element,r=e.map((e,t)=>[t,e]),a=!1,(r.sort(([e,r],[n,i])=>{var o;let s=t(r),l=t(i);return s!==l&&s&&l?(o=s,l.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)?(e>n&&(a=!0),-1):(et):e);l.setState("renderedItems",n),u.setState("renderedItems",n)};il(u,()=>iu(l)),il(l,()=>ih(l,["items"],e=>{u.setState("items",e.items)})),il(l,()=>ih(l,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let a=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),a=[...e].reverse().find(e=>!!e.element),n=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;n&&(null==a?void 0:a.element);){let e=n;if(a&&e.contains(a.element))return n;n=n.parentElement}return av(n).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&a.observe(t.element);return()=>{cancelAnimationFrame(r),a.disconnect()}}));let d=(e,t,r=!1)=>{let a;return t(t=>{let r=t.findIndex(({id:t})=>t===e.id),n=t.slice();if(-1!==r){let o={...a=t[r],...e};n[r]=o,i.set(e.id,o)}else n.push(e),i.set(e.id,e);return n}),()=>{t(t=>{if(!a)return r&&i.delete(e.id),t.filter(({id:t})=>t!==e.id);let n=t.findIndex(({id:t})=>t===e.id);if(-1===n)return t;let o=t.slice();return o[n]=a,i.set(e.id,a),o})}},f=e=>d(e,e=>l.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>aL(f(e),d(e,e=>l.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){let{items:r}=l.getState();(t=r.find(t=>t.id===e))&&i.set(e,t)}return t||null},__unstablePrivateStore:l}}(e),n=aN(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),i=is({...a.getState(),id:aN(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:n,baseElement:aN(null==r?void 0:r.baseElement,null),includesBaseElement:aN(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===n),moves:aN(null==r?void 0:r.moves,0),orientation:aN(e.orientation,null==r?void 0:r.orientation,"both"),rtl:aN(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:aN(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:aN(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:aN(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:aN(e.focusShift,null==r?void 0:r.focusShift,!1)},a,e.store);il(i,()=>id(i,["renderedItems","activeId"],e=>{i.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=sI(e.renderedItems))?void 0:r.id})}));let o=(e="next",t={})=>{var r,a;let n=i.getState(),{skip:o=0,activeId:s=n.activeId,focusShift:l=n.focusShift,focusLoop:u=n.focusLoop,focusWrap:c=n.focusWrap,includesBaseElement:d=n.includesBaseElement,renderedItems:f=n.renderedItems,rtl:h=n.rtl}=t,m="up"===e||"down"===e,p="next"===e||"down"===e,g=m?nJ(function(e,t,r){let a=sP(e);for(let n of e)for(let e=0;ee.id===s);if(!v)return null==(a=sI(g))?void 0:a.id;let y=g.some(e=>e.rowId),A=g.indexOf(v),F=g.slice(A+1),b=sT(F,v.rowId);if(o){let e=b.filter(e=>s?!e.disabled&&e.id!==s:!e.disabled),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}let C=u&&(m?"horizontal"!==u:"vertical"!==u),B=y&&c&&(m?"horizontal"!==c:"vertical"!==c),S=p?(!y||m)&&C&&d:!!m&&d;if(C){let e=sI(function(e,t,r=!1){let a=e.findIndex(e=>e.id===t);return[...e.slice(a+1),...r?[sw]:[],...e.slice(0,a)]}(B&&!S?g:sT(g,v.rowId),s,S),s);return null==e?void 0:e.id}if(B){let e=sI(S?b:F,s);return S?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let x=sI(b,s);return!x&&S?null:null==x?void 0:x.id};return{...a,...i,setBaseElement:e=>i.setState("baseElement",e),setActiveId:e=>i.setState("activeId",e),move:e=>{void 0!==e&&(i.setState("activeId",e),i.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=sI(i.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=sI(nK(i.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:i,includesBaseElement:aN(t.includesBaseElement,null==n?void 0:n.includesBaseElement,!0),orientation:aN(t.orientation,null==n?void 0:n.orientation,"vertical"),focusLoop:aN(t.focusLoop,null==n?void 0:n.focusLoop,!0),focusWrap:aN(t.focusWrap,null==n?void 0:n.focusWrap,!0),virtualFocus:aN(t.virtualFocus,null==n?void 0:n.virtualFocus,!0)}),s=function({popover:e,...t}={}){let r=ip(t.store,im(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));ig(t,r);let a=null==r?void 0:r.getState(),n=oh({...t,store:r}),i=aN(t.placement,null==a?void 0:a.placement,"bottom"),o=is({...n.getState(),placement:i,currentPlacement:i,anchorElement:aN(null==a?void 0:a.anchorElement,null),popoverElement:aN(null==a?void 0:a.popoverElement,null),arrowElement:aN(null==a?void 0:a.arrowElement,null),rendered:Symbol("rendered")},n,r);return{...n,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:aN(t.placement,null==n?void 0:n.placement,"bottom-start")}),l=aN(t.value,null==n?void 0:n.value,t.defaultValue,""),u=aN(t.selectedValue,null==n?void 0:n.selectedValue,null==a?void 0:a.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...s.getState(),value:l,selectedValue:u,resetValueOnSelect:aN(t.resetValueOnSelect,null==n?void 0:n.resetValueOnSelect,c),resetValueOnHide:aN(t.resetValueOnHide,null==n?void 0:n.resetValueOnHide,c&&!e),activeValue:null==n?void 0:n.activeValue},f=is(d,o,s,r);return sG&&il(f,()=>id(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),il(f,()=>{if(e)return aL(id(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),id(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),il(f,()=>id(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",l)})),il(f,()=>id(f,["open"],e=>{e.open||(f.setState("activeId",i),f.setState("moves",0))})),il(f,()=>id(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),il(f,()=>ih(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),a=o.item(r);f.setState("activeValue",null==a?void 0:a.value)})),{...s,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function sj(e={}){var t,r,a,n,i,o,s,l;let u;t=e,u=sk();let[c,d]=iR(sL,e={id:a8((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return a4(d,[(a=e).tag]),iT(c,a,"value","setValue"),iT(c,a,"selectedValue","setSelectedValue"),iT(c,a,"resetValueOnHide"),iT(c,a,"resetValueOnSelect"),Object.assign((o=c,a4(s=d,[(l=a).popover]),iT(o,l,"placement"),n=oc(o,s,l),i=n,a4(d,[a.store]),iT(i,a,"items","setItems"),iT(n=i,a,"activeId","setActiveId"),iT(n,a,"includesBaseElement"),iT(n,a,"virtualFocus"),iT(n,a,"orientation"),iT(n,a,"rtl"),iT(n,a,"focusLoop"),iT(n,a,"focusWrap"),iT(n,a,"focusShift"),n),{tag:a.tag})}function s_(e={}){let t=sj(e);return(0,n.jsx)(it,{value:t,children:e.children})}var sO=(0,o.createContext)(void 0),sU=nd(function(e){let[t,r]=(0,o.useState)();return aH(e={role:"group","aria-labelledby":t,...e=ne(e,e=>(0,n.jsx)(sO.Provider,{value:r,children:e}),[])})});nl(function(e){return nc("div",sU(e))});var sH=nd(function({store:e,...t}){return sU(t)});nl(function(e){return nc("div",sH(e))});var sN=nd(function({store:e,...t}){let r=n7();return a_(e=e||r,!1),"grid"===aD(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=sH({store:e,...t})}),sJ=nl(function(e){return nc("div",sN(e))}),sK=nd(function(e){let t=(0,o.useContext)(sO),r=a8(e.id);return a3(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),aH(e={id:r,"aria-hidden":!0,...e})});nl(function(e){return nc("div",sK(e))});var sV=nd(function({store:e,...t}){return sK(t)});nl(function(e){return nc("div",sV(e))});var sz=nd(function(e){return sV(e)}),sq=nl(function(e){return nc("div",sz(e))}),sQ=e.i(38360);let sW={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},sX=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function sY(e,t,r={}){let{keys:a,threshold:n=sW.MATCHES,baseSort:i=sX,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:a,keyIndex:n}=e,{rank:i,keyIndex:o}=t;return a!==i?a>i?-1:1:n===o?r(e,t):n{let s=sZ(n,u,c),l=t,{minRanking:d,maxRanking:f,threshold:h}=i;return s=sW.MATCHES?s=d:s>f&&(s=f),s>e&&(e=s,r=o,a=h,l=n),{rankedValue:l,rank:e,keyIndex:r,keyThreshold:a}},{rankedValue:s,rank:sW.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:sZ(s,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:h=n}=d;return f>=h&&e.push({...d,item:i,index:o}),e},[])).map(({item:e})=>e)}function sZ(e,t,r){if(e=s$(e,r),(t=s$(t,r)).length>e.length)return sW.NO_MATCH;if(e===t)return sW.CASE_SENSITIVE_EQUAL;let a=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),n=a.next(),i=n.value;if(e.length===t.length&&0===i)return sW.EQUAL;if(0===i)return sW.STARTS_WITH;let o=n;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return sW.WORD_STARTS_WITH;o=a.next()}return i>0?sW.CONTAINS:1===t.length?sW.NO_MATCH:(function(e){let t="",r=" ";for(let a=0;a-1))return sW.NO_MATCH;return r=i-s,a=n/t.length,sW.MATCHES+1/r*a}(e,t)}function s$(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,sQ.default)(e)),e}sY.rankings=sW;let s0={maxRanking:1/0,minRanking:-1/0};var s1=e.i(29402);let s2=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),s3={"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)"},s9={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},s5=(0,ri.getMissionList)().filter(e=>!s2.has(e)).map(e=>{let t,r=(0,ri.getMissionInfo)(e),[a]=(0,ri.getSourceAndPath)(r.resourcePath),n=(t=a.match(/^(.*)(\/[^/]+)$/))?t[1]:"",i=s3[a]??s9[n]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:a,groupName:i,missionTypes:r.missionTypes}}),s8=new Map(s5.map(e=>[e.missionName,e])),s4=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,s1.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,s1.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(s5),s6="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function s7(e){let t,r,a,o,s,l=(0,i.c)(12),{mission:u}=e,c=u.displayName||u.missionName;return l[0]!==c?(t=(0,n.jsx)("span",{className:"MissionSelect-itemName",children:c}),l[0]=c,l[1]=t):t=l[1],l[2]!==u.missionTypes?(r=u.missionTypes.length>0&&(0,n.jsx)("span",{className:"MissionSelect-itemTypes",children:u.missionTypes.map(le)}),l[2]=u.missionTypes,l[3]=r):r=l[3],l[4]!==t||l[5]!==r?(a=(0,n.jsxs)("span",{className:"MissionSelect-itemHeader",children:[t,r]}),l[4]=t,l[5]=r,l[6]=a):a=l[6],l[7]!==u.missionName?(o=(0,n.jsx)("span",{className:"MissionSelect-itemMissionName",children:u.missionName}),l[7]=u.missionName,l[8]=o):o=l[8],l[9]!==a||l[10]!==o?(s=(0,n.jsxs)(n.Fragment,{children:[a,o]}),l[9]=a,l[10]=o,l[11]=s):s=l[11],s}function le(e){return(0,n.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e)}function lt(e){let t,r,a,s,l,u,c,d,f,h,m,p,g,v,y,A,F,b=(0,i.c)(44),{value:C,missionType:B,onChange:S,disabled:x}=e,[E,M]=(0,o.useState)(""),D=(0,o.useRef)(null),k=(0,o.useRef)(B);b[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,o.startTransition)(()=>M(e))},b[0]=t):t=b[0];let w=sj({resetValueOnHide:!0,selectedValue:C,setSelectedValue:e=>{if(e){let t=k.current,r=(0,ri.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),S({missionName:e,missionType:t}),D.current?.blur()}},setValue:t});b[1]!==w?(r=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),D.current?.focus(),w.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},a=[w],b[1]=w,b[2]=r,b[3]=a):(r=b[2],a=b[3]),(0,o.useEffect)(r,a),b[4]!==C?(s=s8.get(C),b[4]=C,b[5]=s):s=b[5];let I=s;e:{let e,t;if(!E){let e;b[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:s4},b[6]=e):e=b[6],l=e;break e}b[7]!==E?(e=sY(s5,E,{keys:["displayName","missionName","missionTypes","groupName"]}),b[7]=E,b[8]=e):e=b[8];let r=e;b[9]!==r?(t={type:"flat",missions:r},b[9]=r,b[10]=t):t=b[10],l=t}let T=l,R=I?I.displayName||I.missionName:C,P="flat"===T.type?0===T.missions.length:0===T.groups.length,G=e=>(0,n.jsx)(ij,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(k.current=r,e.missionName===C&&S({missionName:e.missionName,missionType:r})):k.current=null}else k.current=null},children:(0,n.jsx)(s7,{mission:e})},e.missionName);b[11]!==w?(u=()=>{try{document.exitPointerLock()}catch{}w.show()},c=e=>{"Escape"!==e.key||w.getState().open||D.current?.blur()},b[11]=w,b[12]=u,b[13]=c):(u=b[12],c=b[13]),b[14]!==x||b[15]!==R||b[16]!==u||b[17]!==c?(d=(0,n.jsx)(iF,{ref:D,autoSelect:!0,disabled:x,placeholder:R,className:"MissionSelect-input",onFocus:u,onKeyDown:c}),b[14]=x,b[15]=R,b[16]=u,b[17]=c,b[18]=d):d=b[18],b[19]!==R?(f=(0,n.jsx)("span",{className:"MissionSelect-selectedName",children:R}),b[19]=R,b[20]=f):f=b[20],b[21]!==B?(h=B&&(0,n.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":B,children:B}),b[21]=B,b[22]=h):h=b[22],b[23]!==h||b[24]!==f?(m=(0,n.jsxs)("div",{className:"MissionSelect-selectedValue",children:[f,h]}),b[23]=h,b[24]=f,b[25]=m):m=b[25],b[26]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)("kbd",{className:"MissionSelect-shortcut",children:s6?"⌘K":"^K"}),b[26]=p):p=b[26],b[27]!==m||b[28]!==d?(g=(0,n.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[d,m,p]}),b[27]=m,b[28]=d,b[29]=g):g=b[29];let L="flat"===T.type?T.missions.map(G):T.groups.map(e=>{let[t,r]=e;return t?(0,n.jsxs)(sJ,{className:"MissionSelect-group",children:[(0,n.jsx)(sq,{className:"MissionSelect-groupLabel",children:t}),r.map(G)]},t):(0,n.jsx)(o.Fragment,{children:r.map(G)},"ungrouped")});return b[30]!==P?(v=P&&(0,n.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"}),b[30]=P,b[31]=v):v=b[31],b[32]!==iV||b[33]!==L||b[34]!==v?(y=(0,n.jsxs)(iV,{className:"MissionSelect-list",children:[L,v]}),b[32]=iV,b[33]=L,b[34]=v,b[35]=y):y=b[35],b[36]!==sM||b[37]!==y?(A=(0,n.jsx)(sM,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:"MissionSelect-popover",children:y}),b[36]=sM,b[37]=y,b[38]=A):A=b[38],b[39]!==s_||b[40]!==w||b[41]!==g||b[42]!==A?(F=(0,n.jsxs)(s_,{store:w,children:[g,A]}),b[39]=s_,b[40]=w,b[41]=g,b[42]=A,b[43]=F):F=b[43],F}var lr=e.i(11152),la=e.i(40141);function ln(e){return(0,la.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 li(e){let t,r,a,s,l,u=(0,i.c)(11),{cameraRef:c,missionName:d,missionType:f}=e,{fogEnabled:h}=(0,E.useSettings)(),[m,p]=(0,o.useState)(!1),g=(0,o.useRef)(null);u[0]!==c||u[1]!==h||u[2]!==d||u[3]!==f?(t=async()=>{clearTimeout(g.current);let e=c.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),a=`${r(e.x)},${r(e.y)},${r(e.z)}`,n=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${a}~${n}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${f}`),r.set("fog",h.toString());let a=`${window.location.pathname}?${r}${t}`,n=`${window.location.origin}${a}`;window.history.replaceState(null,"",a);try{await navigator.clipboard.writeText(n),p(!0),g.current=setTimeout(()=>{p(!1)},1100)}catch(e){console.error(e)}},u[0]=c,u[1]=h,u[2]=d,u[3]=f,u[4]=t):t=u[4];let v=t,y=m?"true":"false";return u[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,n.jsx)(lr.FaMapPin,{className:"MapPin"}),a=(0,n.jsx)(ln,{className:"ClipboardCheck"}),s=(0,n.jsx)("span",{className:"ButtonLabel",children:" Copy coordinates URL"}),u[5]=r,u[6]=a,u[7]=s):(r=u[5],a=u[6],s=u[7]),u[8]!==v||u[9]!==y?(l=(0,n.jsxs)("button",{type:"button",className:"IconButton LabelledButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:v,"data-copied":y,id:"copyCoordinatesButton",children:[r,a,s]}),u[8]=v,u[9]=y,u[10]=l):l=u[10],l}function lo(e){return(0,la.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 ls={},ll=function(e,t,r,a,n){var i=new Worker(ls[t]||(ls[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return i.onmessage=function(e){var t=e.data,r=t.$e$;if(r){var a=Error(r[0]);a.code=r[1],a.stack=r[2],n(a,null)}else n(null,t)},i.postMessage(r,a),i},lu=Uint8Array,lc=Uint16Array,ld=Int32Array,lf=new lu([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]),lh=new lu([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]),lm=new lu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lp=function(e,t){for(var r=new lc(31),a=0;a<31;++a)r[a]=t+=1<>1|(21845&lB)<<1;lS=(61680&(lS=(52428&lS)>>2|(13107&lS)<<2))>>4|(3855&lS)<<4,lC[lB]=((65280&lS)>>8|(255&lS)<<8)>>1}for(var lx=function(e,t,r){for(var a,n=e.length,i=0,o=new lc(t);i>l]=u}else for(i=0,a=new lc(n);i>15-e[i]);return a},lE=new lu(288),lB=0;lB<144;++lB)lE[lB]=8;for(var lB=144;lB<256;++lB)lE[lB]=9;for(var lB=256;lB<280;++lB)lE[lB]=7;for(var lB=280;lB<288;++lB)lE[lB]=8;for(var lM=new lu(32),lB=0;lB<32;++lB)lM[lB]=5;var lD=lx(lE,9,0),lk=lx(lE,9,1),lw=lx(lM,5,0),lI=lx(lM,5,1),lT=function(e){for(var t=e[0],r=1;rt&&(t=e[r]);return t},lR=function(e,t,r){var a=t/8|0;return(e[a]|e[a+1]<<8)>>(7&t)&r},lP=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},lG=function(e){return(e+7)/8|0},lL=function(e,t,r){return(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length),new lu(e.subarray(t,r))},lj=["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"],l_=function(e,t,r){var a=Error(t||lj[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,l_),!r)throw a;return a},lO=function(e,t,r,a){var n=e.length,i=a?a.length:0;if(!n||t.f&&!t.l)return r||new lu(0);var o=!r,s=o||2!=t.i,l=t.i;o&&(r=new lu(3*n));var u=function(e){var t=r.length;if(e>t){var a=new lu(Math.max(2*t,e));a.set(r),r=a}},c=t.f||0,d=t.p||0,f=t.b||0,h=t.l,m=t.d,p=t.m,g=t.n,v=8*n;do{if(!h){c=lR(e,d,1);var y=lR(e,d+1,3);if(d+=3,y)if(1==y)h=lk,m=lI,p=9,g=5;else if(2==y){var A=lR(e,d,31)+257,F=lR(e,d+10,15)+4,b=A+lR(e,d+5,31)+1;d+=14;for(var C=new lu(b),B=new lu(19),S=0;S>4;if(k<16)C[S++]=k;else{var w=0,I=0;for(16==k?(I=3+lR(e,d,3),d+=2,w=C[S-1]):17==k?(I=3+lR(e,d,7),d+=3):18==k&&(I=11+lR(e,d,127),d+=7);I--;)C[S++]=w}}var T=C.subarray(0,A),R=C.subarray(A);p=lT(T),g=lT(R),h=lx(T,p,1),m=lx(R,g,1)}else l_(1);else{var k=lG(d)+4,P=e[k-4]|e[k-3]<<8,G=k+P;if(G>n){l&&l_(0);break}s&&u(f+P),r.set(e.subarray(k,G),f),t.b=f+=P,t.p=d=8*G,t.f=c;continue}if(d>v){l&&l_(0);break}}s&&u(f+131072);for(var L=(1<>4;if((d+=15&w)>v){l&&l_(0);break}if(w||l_(2),O<256)r[f++]=O;else if(256==O){_=d,h=null;break}else{var U=O-254;if(O>264){var S=O-257,H=lf[S];U=lR(e,d,(1<>4;N||l_(3),d+=15&N;var R=lF[J];if(J>3){var H=lh[J];R+=lP(e,d)&(1<v){l&&l_(0);break}s&&u(f+131072);var K=f+U;if(f>8},lH=function(e,t,r){r<<=7&t;var a=t/8|0;e[a]|=r,e[a+1]|=r>>8,e[a+2]|=r>>16},lN=function(e,t){for(var r=[],a=0;af&&(f=i[a].s);var h=new lc(f+1),m=lJ(r[c-1],h,0);if(m>t){var a=0,p=0,g=m-t,v=1<t)p+=v-(1<>=g;p>0;){var A=i[a].s;h[A]=0&&p;--a){var F=i[a].s;h[F]==t&&(--h[F],++p)}m=t}return{t:new lu(h),l:m}},lJ=function(e,t,r){return -1==e.s?Math.max(lJ(e.l,t,r+1),lJ(e.r,t,r+1)):t[e.s]=r},lK=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new lc(++t),a=0,n=e[0],i=1,o=function(e){r[a++]=e},s=1;s<=t;++s)if(e[s]==n&&s!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=e[s]}return{c:r.subarray(0,a),n:t}},lV=function(e,t){for(var r=0,a=0;a>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var i=0;i4&&!w[lm[T-1]];--T);var R=u+5<<3,P=lV(n,lE)+lV(i,lM)+o,G=lV(n,g)+lV(i,A)+o+14+3*T+lV(M,w)+2*M[16]+3*M[17]+7*M[18];if(l>=0&&R<=P&&R<=G)return lz(t,c,e.subarray(l,l+u));if(lU(t,c,1+(G15&&(lU(t,c,O[D]>>5&127),c+=O[D]>>12)}}else d=lD,f=lE,h=lw,m=lM;for(var D=0;D255){var U=H>>18&31;lH(t,c,d[U+257]),c+=f[U+257],U>7&&(lU(t,c,H>>23&31),c+=lf[U]);var N=31&H;lH(t,c,h[N]),c+=m[N],N>3&&(lH(t,c,H>>5&8191),c+=lh[N])}else lH(t,c,d[H]),c+=f[H]}return lH(t,c,d[256]),c+f[256]},lQ=new ld([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lW=new lu(0),lX=function(e,t,r,a,n,i){var o=i.z||e.length,s=new lu(a+o+5*(1+Math.ceil(o/7e3))+n),l=s.subarray(a,s.length-n),u=i.l,c=7&(i.r||0);if(t){c&&(l[0]=i.r>>3);for(var d=lQ[t-1],f=d>>13,h=8191&d,m=(1<7e3||E>24576)&&(T>423||!u)){c=lq(e,l,0,F,b,C,S,E,D,x-D,c),E=B=S=0,D=x;for(var R=0;R<286;++R)b[R]=0;for(var R=0;R<30;++R)C[R]=0}var P=2,G=0,L=h,j=w-I&32767;if(T>2&&k==A(x-j))for(var _=Math.min(f,T)-1,O=Math.min(32767,x),U=Math.min(258,T);j<=O&&--L&&w!=I;){if(e[x+P]==e[x+P-j]){for(var H=0;HP){if(P=H,G=j,H>_)break;for(var N=Math.min(j,H-2),J=0,R=0;RJ&&(J=z,I=K)}}}I=p[w=I],j+=w-I&32767}if(G){F[E++]=0x10000000|ly[P]<<18|lb[G];var q=31&ly[P],Q=31&lb[G];S+=lf[q]+lh[Q],++b[257+q],++C[Q],M=x+P,++B}else F[E++]=e[x],++b[e[x]]}}for(x=Math.max(x,M);x=o&&(l[c/8|0]=u,W=o),c=lz(l,c+1,e.subarray(x,W))}i.i=o}return lL(s,0,a+lG(c)+n)},lY=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,a=9;--a;)r=(1&r&&-0x12477ce0)^r>>>1;e[t]=r}return e}(),lZ=function(){var e=-1;return{p:function(t){for(var r=e,a=0;a>>8;e=r},d:function(){return~e}}},l$=function(){var e=1,t=0;return{p:function(r){for(var a=e,n=t,i=0|r.length,o=0;o!=i;){for(var s=Math.min(o+2655,i);o>16),n=(65535&n)+15*(n>>16)}e=a,t=n},d:function(){return e%=65521,t%=65521,(255&e)<<24|(65280&e)<<8|(255&t)<<8|t>>8}}},l0=function(e,t,r,a,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new lu(i.length+e.length);o.set(i),o.set(e,i.length),e=o,n.w=i.length}return lX(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,r,a,n)},l1=function(e,t){var r={};for(var a in e)r[a]=e[a];for(var a in t)r[a]=t[a];return r},l2=function(e,t,r){for(var a=e(),n=e.toString(),i=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>0},us=function(e,t){return uo(e,t)+0x100000000*uo(e,t+4)},ul=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},uu=function(e,t){var r=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&&ul(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var a=0;a<=r.length;++a)e[a+10]=r.charCodeAt(a)}},uc=function(e){(31!=e[0]||139!=e[1]||8!=e[2])&&l_(6,"invalid gzip data");var t=e[3],r=10;4&t&&(r+=(e[10]|e[11]<<8)+2);for(var a=(t>>3&1)+(t>>4&1);a>0;a-=!e[r++]);return r+(2&t)},ud=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},uf=function(e){return 10+(e.filename?e.filename.length+1:0)},uh=function(e,t){var r=t.level;if(e[0]=120,e[1]=(0==r?0:r<6?1:9==r?3:2)<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var a=l$();a.p(t.dictionary),ul(e,2,a.d())}},um=function(e,t){return((15&e[0])!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&l_(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&l_(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function up(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var ug=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 lu(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return e.prototype.p=function(e,t){this.ondata(l0(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||l_(5),this.s.l&&l_(4);var r=e.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var a=new lu(-32768&r);a.set(this.b.subarray(0,this.s.z)),this.b=a}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||l_(5),this.s.l&&l_(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),uv=function(e,t){un([l4,function(){return[ua,ug]}],this,up.call(this,e,t),function(e){onmessage=ua(new ug(e.data))},6,1)};function uy(e,t){return l0(e,t||{},0,0)}var uA=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var r=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new lu(32768),this.p=new lu(0),r&&this.o.set(r)}return e.prototype.e=function(e){if(this.ondata||l_(5),this.d&&l_(4),this.p.length){if(e.length){var t=new lu(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,r=lO(this.p,this.s,this.o);this.ondata(lL(r,t,this.s.b),this.d),this.o=lL(r,this.s.b-32768),this.s.b=this.o.length,this.p=lL(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),uF=function(e,t){un([l8,function(){return[ua,uA]}],this,up.call(this,e,t),function(e){onmessage=ua(new uA(e.data))},7,0)};function ub(e,t){return lO(e,{i:2},t&&t.out,t&&t.dictionary)}(function(){function e(e,t){this.c=lZ(),this.l=0,this.v=1,ug.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,ug.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var r=l0(e,this.o,this.v&&uf(this.o),t&&8,this.s);this.v&&(uu(r,this.o),this.v=0),t&&(ul(r,r.length-8,this.c.d()),ul(r,r.length-4,this.l)),this.ondata(r,t)},e.prototype.flush=function(){ug.prototype.flush.call(this)}})();var uC=function(){function e(e,t){this.v=1,this.r=0,uA.call(this,e,t)}return e.prototype.push=function(e,t){if(uA.prototype.e.call(this,e),this.r+=e.length,this.v){var r=this.p.subarray(this.v-1),a=r.length>3?uc(r):4;if(a>r.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-r.length);this.p=r.subarray(a),this.v=0}uA.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=lG(this.s.p)+9,this.s={i:0},this.o=new lu(0),this.push(new lu(0),t))},e}(),uB=function(e,t){var r=this;un([l8,l6,function(){return[ua,uA,uC]}],this,up.call(this,e,t),function(e){var t=new uC(e.data);t.onmember=function(e){return postMessage(e)},onmessage=ua(t)},9,0,function(e){return r.onmember&&r.onmember(e)})},uS=(function(){function e(e,t){this.c=l$(),this.v=1,ug.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),ug.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var r=l0(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(uh(r,this.o),this.v=0),t&&ul(r,r.length-4,this.c.d()),this.ondata(r,t)},e.prototype.flush=function(){ug.prototype.flush.call(this)}}(),function(){function e(e,t){uA.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(uA.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(um(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&l_(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),uA.prototype.c.call(this,t)},e}()),ux=function(e,t){un([l8,l7,function(){return[ua,uA,uS]}],this,up.call(this,e,t),function(e){onmessage=ua(new uS(e.data))},11,0)},uE=function(){function e(e,t){this.o=up.call(this,e,t)||{},this.G=uC,this.I=uA,this.Z=uS}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,r){e.ondata(t,r)}},e.prototype.push=function(e,t){if(this.ondata||l_(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var r=new lu(this.p.length+e.length);r.set(this.p),r.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 uM(e,t){uE.call(this,e,t),this.queuedSize=0,this.G=uB,this.I=uF,this.Z=ux}uM.prototype.i=function(){var e=this;this.s.ondata=function(t,r,a){e.ondata(t,r,a)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},uM.prototype.push=function(e,t){this.queuedSize+=e.length,uE.prototype.push.call(this,e,t)};var uD="undefined"!=typeof TextEncoder&&new TextEncoder,uk="undefined"!=typeof TextDecoder&&new TextDecoder,uw=0;try{uk.decode(lW,{stream:!0}),uw=1}catch(e){}var uI=function(e){for(var t="",r=0;;){var a=e[r++],n=(a>127)+(a>223)+(a>239);if(r+n>e.length)return{s:t,r:lL(e,r-1)};n?3==n?t+=String.fromCharCode(55296|(a=((15&a)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536)>>10,56320|1023&a):1&n?t+=String.fromCharCode((31&a)<<6|63&e[r++]):t+=String.fromCharCode((15&a)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(a)}};function uT(e,t){if(t){for(var r=new lu(e.length),a=0;a>1)),o=0,s=function(e){i[o++]=e},a=0;ai.length){var l=new lu(o+8+(n-a<<1));l.set(i),i=l}var u=e.charCodeAt(a);u<128||t?s(u):(u<2048?s(192|u>>6):(u>55295&&u<57344?(s(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++a))>>18),s(128|u>>12&63)):s(224|u>>12),s(128|u>>6&63)),s(128|63&u))}return lL(i,0,o)}(function(e){this.ondata=e,uw?this.t=new TextDecoder:this.p=lW}).prototype.push=function(e,t){if(this.ondata||l_(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&l_(8),this.t=null);return}this.p||l_(4);var r=new lu(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length);var a=uI(r),n=a.s,i=a.r;t?(i.length&&l_(8),this.p=null):this.p=i,this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){this.ondata||l_(5),this.d&&l_(4),this.ondata(uT(e),this.d=t||!1)};var uR=function(e){return 1==e?3:e<6?2:+(9==e)},uP=function(e,t){for(;1!=ui(e,t);t+=4+ui(e,t+2));return[us(e,t+12),us(e,t+4),us(e,t+20)]},uG=function(e){var t=0;if(e)for(var r in e){var a=e[r].length;a>65535&&l_(9),t+=a+4}return t},uL=function(e,t,r,a,n,i,o,s){var l=a.length,u=r.extra,c=s&&s.length,d=uG(u);ul(e,t,null!=o?0x2014b50:0x4034b50),t+=4,null!=o&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(i<0&&8),e[t++]=n&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var f=new Date(null==r.mtime?Date.now():r.mtime),h=f.getFullYear()-1980;if((h<0||h>119)&&l_(10),ul(e,t,h<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,-1!=i&&(ul(e,t,r.crc),ul(e,t+4,i<0?-i-2:i),ul(e,t+8,r.size)),ul(e,t+12,l),ul(e,t+14,d),t+=16,null!=o&&(ul(e,t,c),ul(e,t+6,r.attrs),ul(e,t+10,o),t+=14),e.set(a,t),t+=l,d)for(var m in u){var p=u[m],g=p.length;ul(e,t,+m),ul(e,t+2,g),e.set(p,t+4),t+=4+g}return c&&(e.set(s,t),t+=c),t},uj=function(e,t,r,a,n){ul(e,t,0x6054b50),ul(e,t+8,r),ul(e,t+10,r),ul(e,t+12,a),ul(e,t+16,n)},u_=function(){function e(e){this.filename=e,this.c=lZ(),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||l_(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function uO(e,t){var r=this;t||(t={}),u_.call(this,e),this.d=new ug(t,function(e,t){r.ondata(null,e,t)}),this.compression=8,this.flag=uR(t.level)}function uU(e,t){var r=this;t||(t={}),u_.call(this,e),this.d=new uv(t,function(e,t,a){r.ondata(e,t,a)}),this.compression=8,this.flag=uR(t.level),this.terminate=this.d.terminate}function uH(e){this.ondata=e,this.u=[],this.d=1}uO.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},uO.prototype.push=function(e,t){u_.prototype.push.call(this,e,t)},uU.prototype.process=function(e,t){this.d.push(e,t)},uU.prototype.push=function(e,t){u_.prototype.push.call(this,e,t)},uH.prototype.add=function(e){var t=this;if(this.ondata||l_(5),2&this.d)this.ondata(l_(4+(1&this.d)*8,0,1),null,!1);else{var r=uT(e.filename),a=r.length,n=e.comment,i=n&&uT(n),o=a!=e.filename.length||i&&n.length!=i.length,s=a+uG(e.extra)+30;a>65535&&this.ondata(l_(11,0,1),null,!1);var l=new lu(s);uL(l,0,e,r,o,-1);var u=[l],c=function(){for(var e=0,r=u;e0){var a=Math.min(this.c,e.length),n=e.subarray(0,a);if(this.c-=a,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(a)).length)return this.push(e,t)}else{var i=0,o=0,s=void 0,l=void 0;this.p.length?e.length?((l=new lu(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,c=this.c,d=c&&this.d,f=this;oo+30+d+h){var m,p,g=[];f.k.unshift(g),i=2;var v=uo(l,o+18),y=uo(l,o+22),A=function(e,t){if(t){for(var r="",a=0;a=0&&(F.size=v,F.originalSize=y),f.onfile(F)}return"break"}if(c){if(0x8074b50==e)return s=o+=12+(-2==c&&8),i=3,f.c=0,"break";else if(0x2014b50==e)return s=o-=4,i=3,f.c=0,"break"}}();++o);if(this.p=lW,c<0){var h=i?l.subarray(0,s-12-(-2==c&&8)-(0x8074b50==uo(l,s-16)&&4)):l.subarray(0,o);d?d.push(h,!!i):this.k[+(2==i)].push(h)}if(2&i)return this.push(l.subarray(o),t);this.p=l.subarray(o)}t&&(this.c&&l_(13),this.p=null)},uV.prototype.register=function(e){this.o[e.compression]=e},"function"==typeof queueMicrotask&&queueMicrotask;var uz=e.i(48450);let uq=[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 uQ(e){return e.node?e.node.pop:e.leaf.pop}let uW=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:uq[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,r=[];for(let e=0;e<256;e++)r.push({node:null,leaf:this.leaves[e]});for(;1!==t;){let e=0xfffffffe,a=0xffffffff,n=-1,i=-1;for(let o=0;oi?n:i;r[s]={node:o,leaf:null},l!==t-1&&(r[l]=r[t-1]),t--}this.nodes[0]=r[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,r){if(t<0){let a=this.leaves[-(t+1)];a.code=e,a.numBits=r}else{let a=this.nodes[t];this.generateCodes(e,a.index0,r+1),this.generateCodes(e|1<=0)t=e.readFlag()?this.nodes[t].index1:this.nodes[t].index0;else{r.push(this.leaves[-(t+1)].symbol);break}}return String.fromCharCode(...r)}{let t=e.readInt(8);return String.fromCharCode(...e.readBytes(t))}}};class uX{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,r=7&this.bitNum;if(this.bitNum+=e,e+r<=32){let a=0,n=e+r+7>>3;for(let e=0;e>>=r,32===e)?a>>>0:a&(1<>3;for(let e=0;e>>0:a&(1<>3,r=new Uint8Array(t),a=this.bitNum>>3,n=7&this.bitNum,i=8-n;if(0===n)r.set(this.data.subarray(a,a+t));else{let e=this.data[a];for(let o=0;o>n|t<this.maxReadBitNum)return this.error=!0,0;let e=this.bitNum>>3,t=7&this.bitNum,r=uX.f32U8;if(0===t)r[0]=this.data[e],r[1]=this.data[e+1],r[2]=this.data[e+2],r[3]=this.data[e+3];else{let a=8-t;for(let n=0;n<4;n++){let i=this.data[e+n],o=e+n+1>t|o<>>0)}getCompressionPoint(){return this.compressionPoint}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(r>>0),this.lastSendSeq>>0,0===e.packetType&&(this.recvAckMask=(1|this.recvAckMask)>>>0);for(let t=this.highestAckedSeq+1;t<=r;t++)(e.ackMask&1<<(r-t&31))!=0&&(this.lastRecvAckAck=this.lastSeqRecvdAtSend[31&t]>>>0);t-this.lastRecvAckAck>32&&(this.lastRecvAckAck=t-32),this.highestAckedSeq=r;let n=this.lastSeqRecvd!==t&&0===e.packetType;return this.lastSeqRecvd=t,{accepted:!0,dispatchData:n}}parsePacket(e){let t=new uX(e),r=this.readDnetHeader(t),a=this.applyProtocolHeader(r);if(this.packetsParsed++,!a.accepted)return this.protocolRejected++,{dnetHeader:r,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};if(!a.dispatchData)return this.protocolNoDispatch++,{dnetHeader:r,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};let n=this.readRateInfo(t);t.setStringBuffer(!0);let i=this.readGameState(t),o=void 0===i.controlObjectDataStart||void 0!==i.controlObjectData,s=o?this.readEvents(t):[],l=s[s.length-1],u=!l||l.dataBitsEnd!==l.dataBitsStart,c=o&&u?t.getCurPos():void 0,d=o&&u?this.readGhosts(t,r.seqNumber):[];return t.setStringBuffer(!1),{dnetHeader:r,rateInfo:n,gameState:i,events:s,ghosts:d,ghostSectionStart:c}}readDnetHeader(e){let t=e.readFlag(),r=e.readInt(1),a=e.readInt(9),n=e.readInt(9),i=e.readInt(2),o=e.readInt(3),s=o>0?e.readInt(8*o):0;return{gameFlag:t,connectSeqBit:r,seqNumber:a,highestAck:n,packetType:i,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,r,a,n,i,o,s,l,u,c,d,f,h,m,p,g=e.readInt(32);e.readFlag()&&(e.readFlag()&&(t=e.readFloat(7)),e.readFlag()&&(r=1.5*e.readFloat(7))),e.readFlag()&&(a=e.readFlag(),n=e.readFlag()),e.readFlag()&&((i=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&&(u={x:e.readF32(),y:e.readF32(),z:e.readF32()}));let v=e.readFlag(),y=e.readFlag();if(e.readFlag())if(e.readFlag()){let p=e.readInt(10);c=p,d=e.getCurPos();let A=e.savePos(),F=this.ghostTracker.getGhost(p),b=F?this.registry.getGhostParser(F.classId):void 0,C=this.controlParserByGhostIndex.get(p),B=this.registry.getGhostParser(25),S=this.registry.getGhostParser(4),x=[],E=new Set,M=e=>{!e?.readPacketData||E.has(e.name)||(E.add(e.name),x.push(e))};M(b),M(C),M(B),M(S);let D=!1;for(let t of x){e.restorePos(A);try{let r=this.getConnectionContext(),a=t.readPacketData(e,r);if(e.getCurPos()-d<=0||e.isError())continue;h=a,f=e.getCurPos(),this.controlParserByGhostIndex.set(p,t),r.compressionPoint!==this.compressionPoint&&(this.compressionPoint=r.compressionPoint,m=this.compressionPoint),this.controlObjectParsed++,D=!0;break}catch{}}if(!D)return e.restorePos(A),f=d,this.controlObjectFailed++,{lastMoveAck:g,damageFlash:t,whiteOut:r,selfLocked:a,selfHomed:n,seekerTracking:i,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:u,pinged:v,jammed:y,controlObjectGhostIndex:c,controlObjectDataStart:d,controlObjectDataEnd:f,controlObjectData:h,targetVisibility:[]}}else m={x:e.readF32(),y:e.readF32(),z:e.readF32()},this.compressionPoint=m;let A=[];for(;e.readFlag();)A.push({index:e.readInt(4),mask:e.readInt(32)});return e.readFlag()&&(p=e.readInt(8)),{lastMoveAck:g,damageFlash:t,whiteOut:r,selfLocked:a,selfHomed:n,seekerTracking:i,seekerTrackingPos:o,seekerMode:s,seekerObjectGhostIndex:l,targetPos:u,pinged:v,jammed:y,controlObjectGhostIndex:c,controlObjectDataStart:d,controlObjectDataEnd:f,controlObjectData:h,compressionPoint:m,targetVisibility:A.length>0?A:void 0,cameraFov:p}}readEvents(e){let t=[],r=!0,a=-2;for(;;){let n,i,o,s=e.readFlag();if(r&&!s){if(r=!1,!e.readFlag()){this.dispatchGuaranteedEvents(t);break}}else if(r||s){if(!s)break}else{this.dispatchGuaranteedEvents(t);break}!r&&(a=n=e.readFlag()?a+1&127:e.readInt(7),(i=n|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,r=e.classId;if("number"==typeof t&&"number"==typeof r){let e=this.registry.getGhostParser(r);this.ghostTracker.createGhost(t,r,e?.name??`unknown_${r}`)}}"SimDataBlockEvent"===t&&this.dataBlockDataMap&&e.dataBlockData&&"number"==typeof e.objectId&&this.dataBlockDataMap.set(e.objectId,e.dataBlockData)}readGhosts(e,t){let r=[];if(!e.readFlag())return r;let a=e.readInt(3)+3;for(;e.readFlag();){let n;if(e.isError())break;let i=e.readInt(a);if(e.isError())break;if(e.readFlag()){this.ghostTracker.deleteGhost(i),this.ghostDeletes++,r.push({index:i,type:"delete",updateBitsStart:e.getCurPos(),updateBitsEnd:e.getCurPos()});continue}let o=!this.ghostTracker.hasGhost(i);n=o?e.readInt(7)+0:this.ghostTracker.getGhost(i)?.classId;let s=e.getCurPos(),l=void 0!==n?this.registry.getGhostParser(n):void 0;if(o&&!l){this.ghostsTrackerDiverged++,u0("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,i,n,s,e.getMaxPos(),this.ghostTracker.size()),r.push({index:i,type:"create",classId:n,updateBitsStart:s,updateBitsEnd:s});break}let u=!1;if(l)try{let t=this.getConnectionContext();t.currentGhostIndex=i;let a=l.unpackUpdate(e,o,t),c=e.getCurPos();o&&void 0!==n?(this.ghostTracker.createGhost(i,n,l.name),this.ghostCreatesParsed++):this.ghostUpdatesParsed++,r.push({index:i,type:o?"create":"update",classId:n,updateBitsStart:s,updateBitsEnd:c,parsedData:a}),u=!0}catch(c){this.ghostsFailed++;let a=o?"create":"update",u=c instanceof Error?c.message:String(c);u0("FAIL pkt=%d seq=%d #%d idx=%d op=%s classId=%d parser=%s bit=%d/%d trackerSize=%d err=%s",this.packetsParsed,t,r.length,i,a,n,l.name,s,e.getMaxPos(),this.ghostTracker.size(),u)}if(!u){u0("STOP pkt=%d seq=%d idx=%d op=%s classId=%d parser=%s bit=%d/%d",this.packetsParsed,t,i,o?"create":"update",n,l?.name??"NONE",s,e.getMaxPos()),r.push({index:i,type:o?"create":"update",classId:n,updateBitsStart:s,updateBitsEnd:s});break}}return r}emptyGameState(){return{lastMoveAck:0,pinged:!1,jammed:!1}}}class u2{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 r=0,a=[];for(let n=0;n0&&(a.sounds=t)}if(e.readFlag()){let t=[];for(let r=0;r<4;r++)e.readFlag()&&t.push({index:r,sequence:e.readInt(5),state:e.readInt(2),forward:e.readFlag(),atEnd:e.readFlag()});t.length>0&&(a.threads=t)}let n=!1;if(e.readFlag()){let r=[];for(let a=0;a<8;a++)if(e.readFlag()){let i={index:a};e.readFlag()?i.dataBlockId=u5(e):i.dataBlockId=0,e.readFlag()&&(e.readFlag()?i.skinTagIndex=e.readInt(10):i.skinName=e.readString(),n=!0),i.wet=e.readFlag(),i.ammo=e.readFlag(),i.loaded=e.readFlag(),i.target=e.readFlag(),i.triggerDown=e.readFlag(),i.fireCount=e.readInt(3),t&&(i.imageExtraFlag=e.readFlag()),r.push(i)}r.length>0&&(a.images=r)}if(e.readFlag()){if(e.readFlag()){a.stateAEnabled=e.readFlag(),a.stateB=e.readFlag();let t=e.readFlag();a.hasInvulnerability=t,t?(a.invulnerabilityVisual=e.readFlag(),a.invulnerabilityTicks=e.readU32()):a.binaryCloak=e.readFlag()}if(e.readFlag())if(e.readFlag()){let t=e.readFlag();a.stateBMode=t,t?a.energyPackOn=!0:a.energyPackOn=!1}else a.shieldNormal=e.readNormalVector(8),a.energyPercent=e.readFloat(5);e.readFlag()&&(a.stateValue1=e.readU32(),a.stateValue2=e.readU32())}return n&&(a.imageSkinDirty=!0),e.readFlag()&&(e.readFlag()?(a.mountObject=e.readInt(10),a.mountNode=e.readInt(5)):a.mountObject=-1),a}function u6(e,t,r){let a=u4(e,t,r);if(e.readFlag()&&(a.impactSound=e.readInt(3)),e.readFlag()&&(a.action=e.readInt(8),a.actionHoldAtEnd=e.readFlag(),a.actionAtEnd=e.readFlag(),a.actionFirstPerson=e.readFlag(),!a.actionAtEnd&&e.readFlag()&&(a.actionAnimPos=e.readSignedFloat(6))),e.readFlag()&&(a.armAction=e.readInt(8)),e.readFlag())return a;if(e.readFlag()){if(a.actionState=e.readInt(3),e.readFlag()&&(a.recoverTicks=e.readInt(7)),a.moveFlag0=e.readFlag(),a.moveFlag1=e.readFlag(),a.position=e.readCompressedPoint(r.compressionPoint),e.readFlag()){let t=e.readInt(13)/32,r=e.readNormalVector(10);a.velocity={x:r.x*t,y:r.y*t,z:r.z*t}}else a.velocity={x:0,y:0,z:0};a.headX=e.readSignedFloat(6),a.headZ=e.readSignedFloat(6),a.rotationZ=2*e.readFloat(7)*Math.PI,a.move=u9(e),a.allowWarp=e.readFlag()}return a.energy=e.readFloat(5),a}function u7(e,t){let r={};if(r.energyLevel=e.readF32(),r.rechargeRate=e.readF32(),r.actionState=e.readInt(3),e.readFlag()&&(r.recoverTicks=e.readInt(7)),e.readFlag()&&(r.jumpDelay=e.readInt(7)),e.readFlag()){let a={x:e.readF32(),y:e.readF32(),z:e.readF32()};r.position=a,t.compressionPoint=a,r.velocity={x:e.readF32(),y:e.readF32(),z:e.readF32()},r.jumpSurfaceLastContact=e.readInt(4)}if(r.headX=e.readF32(),r.headZ=e.readF32(),r.rotationZ=e.readF32(),e.readFlag()){let a=e.readInt(10);r.controlObjectGhost=a;let n=t.ghostTracker.getGhost(a),i=n?t.getGhostParser?.(n.classId):void 0;if(i?.readPacketData){let n=t.currentGhostIndex;t.currentGhostIndex=a,r.controlObjectData=i.readPacketData(e,t),t.currentGhostIndex=n}}return r.disableMove=e.readFlag(),r.pilot=e.readFlag(),r}function ce(e,t,r){let a=u4(e,t,r);return(a.jetting=e.readFlag(),e.readFlag())?a._controlledEarlyReturn=!0:(a.steeringYaw=e.readFloat(9),a.steeringPitch=e.readFloat(9),a.move=u9(e),a.frozen=e.readFlag(),e.readFlag()&&(a.position=e.readCompressedPoint(r.compressionPoint),a.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},a.linMomentum=e.readPoint3F(),a.angMomentum=e.readPoint3F()),e.readFlag()&&(a.energy=e.readFloat(8))),a}function ct(e,t){let r={};r.energyLevel=e.readF32(),r.rechargeRate=e.readF32(),r.steering={x:e.readF32(),y:e.readF32()};let a={x:e.readF32(),y:e.readF32(),z:e.readF32()};return r.linPosition=a,r.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},r.linMomentum=e.readPoint3F(),r.angMomentum=e.readPoint3F(),r.disableMove=e.readFlag(),r.frozen=e.readFlag(),t.compressionPoint=a,r}function cr(e,t){let r=ct(e,t);r.braking=e.readFlag();let a=4,n=t.currentGhostIndex;if(void 0!==n){let e=cK.get(n);void 0!==e&&(a=e)}let i=[];for(let t=0;t64)throw Error(`Invalid Sky fogVolumeCount: ${t}`);a.fogVolumeCount=t,a.useSkyTextures=e.readBool(),a.renderBottomTexture=e.readBool(),a.skySolidColor={r:e.readF32(),g:e.readF32(),b:e.readF32()},a.windEffectPrecipitation=e.readBool();let r=[];for(let a=0;a3)throw Error(`Invalid precipitation colorCount: ${t}`);let r=[];for(let a=0;aMath.floor(e.getRemainingBits()/96))throw Error(`Invalid physicalZone point count: ${t}`);let r=[];for(let a=0;aMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone plane count: ${n}`);let i=[];for(let t=0;tMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone edge count: ${o}`);let s=[];for(let t=0;t0&&(r.audioData=e.readBitsBuffer(8*a)),r}function dn(e,t){return{type:"GhostingMessageEvent",sequence:e.readU32(),message:e.readInt(3),ghostCount:e.readInt(11)}}function di(e,t){let r={type:"GhostAlwaysObjectEvent"};r.ghostIndex=e.readInt(10);let a=e.readFlag();if(r._hasObjectData=a,a){let a=e.readInt(7);r.classId=a;let n=t.getGhostParser?.(a);if(!n)throw Error(`No ghost parser for GhostAlwaysObjectEvent classId=${a}`);r.objectData=n.unpackUpdate(e,!0,t)}return r}function ds(e,t){let r={type:"PathManagerEvent"};if(e.readFlag()){r.messageType="NewPaths";let t=e.readU32(),a=[];for(let r=0;r0&&(t.hudImages=r),t}function dB(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=dv(e),t.muzzleFlash=dv(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=dv(e),t.accuFire=e.readFlag();let r=[];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=dv(e),null!==t.emitter&&(t.emitterTime=e.readF32(),t.emitterNode=e.readS32()),t.sound=dv(e),r.push(t)}return t.states=r,t}function dS(e){let t=dC(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=dv(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 r=[];for(let t=0;t<32;t++)e.readFlag()?r.push(e.readInt(11)):r.push(null);t.sounds=r,t.boxSize={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.footPuffEmitter=dv(e),t.footPuffNumParts=e.readF32(),t.footPuffRadius=e.readF32(),t.decalData=dv(e),t.decalOffset=e.readF32(),t.dustEmitter=dv(e),t.splash=dv(e);let a=[];for(let t=0;t<3;t++)a.push(dv(e));return t.splashEmitters=a,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 dx(e){let t=dC(e);t.bodyRestitution=e.readF32(),t.bodyFriction=e.readF32();let r=[];for(let t=0;t<2;t++)r.push(dv(e));t.impactSounds=r,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 a=[];for(let t=0;t<5;t++)a.push(dv(e));t.waterSounds=a,t.dustEmitter=dv(e);let n=[];for(let t=0;t<3;t++)n.push(dv(e));t.damageEmitters=n;let i=[];for(let t=0;t<2;t++)i.push(dv(e));return t.splashEmitters=i,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 dE(e){let t=dx(e);t.jetActivateSound=dv(e),t.jetDeactivateSound=dv(e);let r=[];for(let t=0;t<4;t++)r.push(dv(e));return t.jetEmitters=r,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 dM(e){let t=dx(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=dv(e),t.thrustSound=dv(e),t.turboSound=dv(e);let r=[];for(let t=0;t<3;t++)r.push(dv(e));return t.jetEmitters=r,t.dustTrailEmitter=dv(e),t.mainThrustEmitterFactor=e.readF32(),t.strafeThrustEmitterFactor=e.readF32(),t.reverseThrustEmitterFactor=e.readF32(),t}function dD(e){let t=dx(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=dv(e),t.jetSound=dv(e),t.engineSound=dv(e),t.squealSound=dv(e),t.wadeSound=dv(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 dk(e){let t=dC(e);return t.noIndividualDamage=e.readFlag(),t.dynamicTypeField=e.readS32(),t}function dw(e){let t=dk(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 dI(e){let t=dB(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 dT(e){let t=dC(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 dR(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.activateEmitter=dv(e),t.maintainEmitter=dv(e),t.activateSound=dv(e),t.maintainSound=dv(e),t.explosion=dv(e),t.splash=dv(e),t.bounceExplosion=dv(e),t.bounceSound=dv(e),t.underwaterExplosion=dv(e);let r=[];for(let t=0;t<6;t++)r.push(dv(e));return t.decals=r,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=dF(e),t.depthTolerance=e.readF32(),t}function dP(e){let t=dR(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 dG(e){let t=dR(e);return t.grenadeElasticity=e.readS32(),t.grenadeFriction=e.readF32(),t.dragCoefficient=e.readF32(),t.windCoefficient=e.readF32(),t.gravityMod=e.readF32(),t.muzzleVelocity=e.readF32(),t.drag=e.readF32(),t.lifetimeMS=e.readS32(),t}function dL(e){let t=dR(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=dF(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=dv(e),t.puffEmitter=dv(e),t.exhaustEmitter=dv(e),t}function dj(e){let t=dR(e);t.maxRifleRange=e.readF32(),t.rifleHeadMultiplier=e.readF32(),t.beamColor=dA(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=dA(e),t.lightRadius=e.readF32();let r=[];for(let t=0;t<12;t++)r.push(e.readString());return t.textures=r,t}function d_(e){let t=dR(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=dv(e);let r=[],a=[],n=[],i=[];for(let t=0;t<2;t++)r.push(e.readF32()),a.push(e.readF32()),n.push(e.readF32()),i.push(e.readF32());t.startWidth=r,t.endWidth=a,t.boltSpeed=n,t.texWrap=i;let o=[];for(let t=0;t<4;t++)o.push(e.readString());return t.textures=o,t.emitter=dv(e),t}function dO(e){let t=dR(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=dv(e),t}function dU(e){let t=dR(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 dH(e){let t=dR(e);t.maxRifleRange=e.readF32(),t.beamColor=dA(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 r=[];for(let t=0;t<4;t++)r.push(e.readString());return t.textures=r,t}function dN(e){let t=dP(e);return t.tracerLength=e.readF32(),t.tracerAlpha=e.readF32(),t.tracerMinPixels=e.readF32(),t.crossViewFraction=dF(e),t.tracerColor=dA(e),t.tracerWidth=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=dF(e),t.textureName0=e.readString(),t.textureName1=e.readString(),t}function dJ(e){let t=dG(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 dK(e){let t=dP(e);return t.numFlares=e.readF32(),t.flareColor=dA(e),t.flareTexture=e.readString(),t.smokeTexture=e.readString(),t.size=e.readF32(),t.flareModTexture=e.readF32(),t.smokeSize=e.readF32(),t}function dV(e){let t=dG(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 dz(e){let t=dG(e);return t.size=e.readF32(),t.useLensFlare=dF(e),t.flareTexture=e.readString(),t.lensFlareTexture=e.readString(),t}function dq(e){let t={};t.dtsFileName=e.readString(),t.soundProfile=dv(e),t.particleEmitter=dv(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=dv(e),t.debris=dv(e);let r=[];for(let t=0;t<4;t++)r.push(dv(e));t.emitters=r;let a=[];for(let t=0;t<5;t++)a.push(dv(e));t.subExplosions=a;let n=e.readRangedU32(0,4),i=[];for(let t=0;t0&&fh("DataBlock binding: %d/%d bound, missing parsers: %s",t,uY.length,r.join(", "));const{bound:a,missing:n}=this.registry.bindDeterministicGhosts(uZ,0);n.length>0&&fh("Ghost binding: %d/%d bound, missing parsers: %s",a,uZ.length,n.join(", "));const{bound:i,missing:o}=this.registry.bindDeterministicEvents(u$,255);o.length>0&&fh("Event binding: %d/%d bound, missing parsers: %s",i,u$.length,o.join(", ")),this.packetParser=new u1(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,r=0,a=0;for(;a+2<=e.length;){let n=4095&t.getUint16(a,!0);if((a+=2+n)>e.length)break;r++}this._blockCount=r}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();fh('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),r=this.readInitialBlock(t);this.offset+=e.initialBlockSize;let a=this.buffer.subarray(this.offset);fh("compressed block stream: %d bytes",a.length);let n=await new Promise((e,t)=>{var r,n;r=(r,a)=>{r?t(r):e(a)},n||(n=r,r={}),"function"!=typeof n&&l_(7),ur(a,r,[l8],function(e){return ue(ub(e.data[0],ut(e.data[1])))},1,n)});return fh("decompressed block stream: %d bytes",n.length),this._decompressedData=n,this._decompressedView=new DataView(n.buffer,n.byteOffset,n.byteLength),this.setupPacketParser(r),this._header=e,this._initialBlock=r,this._blockStreamOffset=0,this._blockCursor=0,this._loaded=!0,{header:e,initialBlock:r}}nextBlock(){if(!this._loaded)throw Error("must call load() first");let e=this._decompressedData,t=this._decompressedView,r=this._blockStreamOffset;if(r+2>e.length)return;let a=t.getUint16(r,!0),n=a>>12,i=4095&a;if(r+2+i>e.length)return void fp("block %d: size %d would exceed decompressed data (offset=%d remaining=%d), stopping",this._blockCursor,i,r+2,e.length-r-2);let o=e.subarray(r+2,r+2+i);this._blockStreamOffset=r+2+i;let s={index:this._blockCursor,type:n,size:i,data:o};if(this._blockCursor++,0===n)try{s.parsed=this.packetParser.parsePacket(o)}catch{}else if(1===n)this.packetParser.onSendPacketTrigger();else if(2===n&&64===i)try{s.parsed=this.readRawMove(o)}catch{}else if(3===n&&8===i)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 r=0;r=128&&t<128+uY.length?uY[t-128]:`unknown(${t})`;throw Error(`No parser for DataBlock classId ${t} (${e}) at bit ${i}`)}}fh("all %d/%d DataBlocks parsed (%d payloads), bit position after DataBlocks: %d",l,i,s.size,a.getCurPos());let u=a.readU8(),c=[];for(let e=0;e<6;e++)c.push(a.readU32());let d=[];for(let e=0;e<16;e++)d.push(a.readU32());let f=a.readU32(),h=[];for(let e=0;e>3<<3),this.readSimpleTargetManager(a),this.readSimpleTargetManager(a),fm('after sequential tail bit=%d mission="%s" CRC=0x%s',a.getCurPos(),w,I.toString(16))}catch(e){r=e instanceof Error?e.message:String(e)}finally{this.ghostTracker=S}let T=C-a.getCurPos(),R=w.length>0?w.split("").filter(e=>{let t=e.charCodeAt(0);return t>=32&&t<=126}).length/w.length:1,P=w.length>0&&R>=.8&&void 0===r;return fh('initial block: events=%d ghosts=%d ghostingSeq=%d controlObj=%d mission="%s" CRC=0x%s valid=%s%s',x.length,D.length,M,k,w,I.toString(16),P,r?` error=${r}`:""),{taggedStrings:n,dataBlockHeaders:o,dataBlockCount:l,dataBlocks:s,demoSetting:u,connectionFields:c,stateArray:d,scoreEntries:h,demoValues:m,sensorGroupColors:p,targetEntries:g,connectionState:v,roundTripTime:y,packetLoss:A,pathManager:F,notifyCount:b,nextRecvEventSeq:E,ghostingSequence:M,initialGhosts:D,initialEvents:x,controlObjectGhostIndex:k,controlObjectData:t,missionName:w,missionCRC:I,phase2TrailingBits:T,phase2Valid:P,phase2Error:r}}readScoreEntry(e){let t=e.readFlag()?e.readInt(16):0,r=e.readFlag()?e.readInt(16):0,a=e.readFlag()?e.readInt(16):0,n=e.readInt(6),i=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:r,score:a,field0:n,field1:i,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 r=0;r<32;r++)for(let a=0;a<32;a++)e.readFlag()&&t.push({group:r,targetGroup:a,r:e.readU8(),g:e.readU8(),b:e.readU8(),a:e.readU8()});let r=[];for(let t=0;t<512;t++){if(!e.readFlag())continue;let a={targetId:t,sensorGroup:0,targetData:0,damageLevel:0};e.readFlag()&&(a.sensorData=e.readU32()),e.readFlag()&&(a.voiceMapData=e.readU32()),e.readFlag()&&(a.name=e.readString()),e.readFlag()&&(a.skin=e.readString()),e.readFlag()&&(a.skinPref=e.readString()),e.readFlag()&&(a.voice=e.readString()),e.readFlag()&&(a.typeDescription=e.readString()),a.sensorGroup=e.readInt(5),a.targetData=e.readInt(9),t>=32&&e.readFlag()&&(a.dataBlockRef=e.readInt(11)),a.damageLevel=e.readFloat(7),r.push(a)}return{sensorGroupColors:t,targets:r}}readPathManager(e){let t=[],r=e.readU32();for(let a=0;athis.registry.getDataBlockParser(e)};t=i.unpack(e,r)}catch{r.push({classId:a,guaranteed:!0,dataBitsStart:n,dataBitsEnd:n});break}else{r.push({classId:a,guaranteed:!0,dataBitsStart:n,dataBitsEnd:n});break}r.push({classId:a,guaranteed:!0,dataBitsStart:n,dataBitsEnd:e.getCurPos(),parsedData:t}),fm(" event classId=%d bits=%d",a,e.getCurPos()-n)}return{nextRecvEventSeq:t,events:r}}readGhostStartBlock(e,t){let r=e.readU32(),a=[];fm("ghost block: seq=%d bit=%d",r,e.getCurPos());let n=this.registry.getGhostCatalog(),i=8*e.getBuffer().length,o=new Map;for(let[e,r]of t)o.set(e,r.data);for(;e.readFlag()&&!e.isError();){let r=e.readInt(10),s=e.readInt(7)+0,l=e.getCurPos(),u=[],c=new Set,{entry:d}=this.identifyGhostViaDataBlock(e,t,n),f=this.registry.getGhostParser(s);f&&(u.push({entry:f,method:"registry"}),c.add(f)),d&&!c.has(d)&&(u.push({entry:d,method:"datablock"}),c.add(d));let h={getDataBlockData:e=>o.get(e),getDataBlockParser:e=>this.registry.getDataBlockParser(e)},m=!1;for(let{entry:t,method:n}of u){let o="registry"===n,u=this.tryGhostParser(e,t,l,i,!1,h,o);if(!1!==u){this.ghostTracker.createGhost(r,s,t.name),fm(" ghost idx=%d classId=%d parser=%s bits=%d via=%s",r,s,t.name,e.getCurPos()-l,n),a.push({index:r,type:"create",classId:s,updateBitsStart:l,updateBitsEnd:e.getCurPos(),parsedData:u}),m=!0;break}}if(!m){fm(" ghost idx=%d classId=%d NO PARSER (stopping at bit=%d, remaining=%d)",r,s,l,i-l);break}}return fm("ghost loop ended at bit=%d remaining=%d count=%d",e.getCurPos(),i-e.getCurPos(),a.length),{ghostingSequence:r,ghosts:a}}tryGhostParser(e,t,r,a,n=!1,i,o=!1){let s=e.savePos();n||fm(" try %s: startBit=%d",t.name,r);try{let l=t.unpackUpdate(e,!0,{compressionPoint:{x:0,y:0,z:0},ghostTracker:this.ghostTracker,...i}),u=e.getCurPos()-r,c=a-e.getCurPos();if(e.isError()||!o&&u<3)return n||fm(" reject %s: bits=%d isError=%s",t.name,u,e.isError()),e.restorePos(s),!1;if(c>1e3){let r=e.getCurPos(),a=e.readFlag();if(e.setCurPos(r),!a)return n||fm(" reject %s: bits=%d misaligned (remaining=%d)",t.name,u,c),e.restorePos(s),!1}return l??{}}catch(r){return n||fm(" reject %s: error at bit=%d: %s",t.name,e.getCurPos(),r instanceof Error?r.message:String(r)),e.restorePos(s),!1}}identifyGhostViaDataBlock(e,t,r){let a;if(!t)return{entry:void 0,dbFlag:!1};let n=e.savePos(),i=!1;try{if(i=e.readFlag()){let n=e.readInt(11),i=t.get(n);if(i){let e=i.className.replace(/Data$/,"");(a=r.get(e))||fm(" identifyGhostViaDataBlock: dbId=%d className=%s ghostName=%s (no ghost parser)",n,i.className,e)}else fm(" identifyGhostViaDataBlock: dbId=%d (no DataBlock found)",n)}else fm(" identifyGhostViaDataBlock: DataBlock flag=0")}catch{}return e.restorePos(n),{entry:a,dbFlag:i}}readRawMove(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=t.getInt32(0,!0),a=t.getInt32(4,!0),n=t.getInt32(8,!0),i=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),l=t.getFloat32(24,!0),u=t.getFloat32(28,!0),c=t.getFloat32(32,!0),d=t.getFloat32(36,!0),f=t.getFloat32(40,!0),h=t.getFloat32(44,!0),m=t.getUint32(48,!0),p=t.getUint32(52,!0),g=0!==e[56],v=[];for(let t=0;t<6;t++)v.push(0!==e[57+t]);return{px:r,py:a,pz:n,pyaw:i,ppitch:o,proll:s,x:l,y:u,z:c,yaw:d,pitch:f,roll:h,id:m,sendCount:p,freeLook:g,trigger:v}}readInfoBlock(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{value1:t.getUint32(0,!0),value2:t.getFloat32(4,!0)}}}let fv=Object.freeze({r:0,g:255,b:0}),fy=Object.freeze({r:255,g:0,b:0}),fA=new Set(["FlyingVehicle","HoverVehicle","WheeledVehicle"]),fF=new Set(["BombProjectile","EnergyProjectile","FlareProjectile","GrenadeProjectile","LinearFlareProjectile","LinearProjectile","Projectile","SeekerProjectile","TracerProjectile"]),fb=new Set(["LinearProjectile","TracerProjectile","LinearFlareProjectile","Projectile"]),fC=new Set(["GrenadeProjectile","EnergyProjectile","FlareProjectile","BombProjectile"]),fB=new Set(["SeekerProjectile"]),fS=new Set(["StaticShape","ScopeAlwaysShape","Turret","BeaconObject","ForceFieldBare"]),fx=new Set(["TSStatic","InteriorInstance","TerrainBlock","Sky","Sun","MissionArea","PhysicalZone","MissionMarker","SpawnSphere","VehicleBlocker","Camera"]),fE=.494*Math.PI,fM=new u.Matrix4,fD=new u.Quaternion;function fk(e){return null!=e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function fw(e,t,r){return er?r:e}function fI(e){let t=-e/2;return[0,Math.sin(t),0,Math.cos(t)]}function fT(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(e.z)||!Number.isFinite(e.w))return null;let t=-e.y,r=-e.z,a=-e.x,n=e.w,i=t*t+r*r+a*a+n*n;if(i<=1e-12)return null;let o=1/Math.sqrt(i);return[t*o,r*o,a*o,n*o]}function fR(e){let t="";for(let r=0;r=32&&(t+=e[r]);return t}function fP(e){return"Player"===e?"Player":fA.has(e)?"Vehicle":"Item"===e?"Item":fF.has(e)?"Projectile":fS.has(e)?"Deployable":"Ghost"}function fG(e,t){return"Player"===e?`player_${t}`:fA.has(e)?`vehicle_${t}`:"Item"===e?`item_${t}`:fF.has(e)?`projectile_${t}`:fS.has(e)?`deployable_${t}`:`ghost_${t}`}function fL(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w}function fj(e){return!!e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z}function f_(e){if(e){for(let t of[e.shapeName,e.projectileShapeName,e.shapeFileName,e.shapeFile,e.model])if("string"==typeof t&&t.length>0)return t}}function fO(e,t){if(e)for(let r of t){let t=e[r];if("number"==typeof t&&Number.isFinite(t))return t}}function fU(e,t){if(e)for(let r of t){let t=e[r];if("string"==typeof t&&t.length>0)return t}}function fH(e){return e?"number"==typeof e.cameraMode?"camera":"number"==typeof e.rotationZ?"player":null:null}class fN{parser;initialBlock;registry;netStrings=new Map;targetNames=new Map;targetTeams=new Map;sensorGroupColors=new Map;state;constructor(e){this.parser=e,this.registry=e.getRegistry();const t=e.initialBlock;this.initialBlock={dataBlocks:t.dataBlocks,initialGhosts:t.initialGhosts,controlObjectGhostIndex:t.controlObjectGhostIndex,controlObjectData:t.controlObjectData,targetEntries:t.targetEntries,sensorGroupColors:t.sensorGroupColors,taggedStrings:t.taggedStrings},this.state={moveTicks:0,moveYawAccum:0,movePitchAccum:0,yawOffset:0,pitchOffset:0,lastAbsYaw:0,lastAbsPitch:0,lastControlType:"player",isPiloting:!1,lastOrbitDistance:void 0,exhausted:!1,latestFov:100,latestControl:{ghostIndex:t.controlObjectGhostIndex,data:t.controlObjectData,position:fk(t.controlObjectData?.position)?t.controlObjectData?.position:void 0},camera:null,entitiesById:new Map,entityIdByGhostIndex:new Map,lastStatus:{health:1,energy:1},nextExplosionId:0,playerSensorGroup:0},this.reset()}reset(){for(let[e,t]of(this.parser.reset(),this.netStrings.clear(),this.targetNames.clear(),this.targetTeams.clear(),this.sensorGroupColors.clear(),this.state.entitiesById.clear(),this.state.entityIdByGhostIndex.clear(),this.initialBlock.taggedStrings))this.netStrings.set(e,t);for(let e of this.initialBlock.targetEntries)e.name&&this.targetNames.set(e.targetId,fR(e.name)),this.targetTeams.set(e.targetId,e.sensorGroup);for(let e of this.initialBlock.sensorGroupColors){let t=this.sensorGroupColors.get(e.group);t||(t=new Map,this.sensorGroupColors.set(e.group,t)),t.set(e.targetGroup,{r:e.r,g:e.g,b:e.b})}if(this.state.playerSensorGroup=0,this.state.moveTicks=0,this.state.moveYawAccum=0,this.state.movePitchAccum=0,this.state.yawOffset=0,this.state.pitchOffset=0,this.state.lastAbsYaw=0,this.state.lastAbsPitch=0,this.state.lastControlType=fH(this.initialBlock.controlObjectData)??"player",this.state.isPiloting="player"===this.state.lastControlType&&!!(this.initialBlock.controlObjectData?.pilot||this.initialBlock.controlObjectData?.controlObjectGhost!=null),this.state.lastCameraMode="camera"===this.state.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.cameraMode?this.initialBlock.controlObjectData.cameraMode:void 0,this.state.lastOrbitGhostIndex="camera"===this.state.lastControlType&&"number"==typeof this.initialBlock.controlObjectData?.orbitObjectGhostIndex?this.initialBlock.controlObjectData.orbitObjectGhostIndex:void 0,"camera"===this.state.lastControlType){let e=this.initialBlock.controlObjectData?.minOrbitDist,t=this.initialBlock.controlObjectData?.maxOrbitDist,r=this.initialBlock.controlObjectData?.curOrbitDist;"number"==typeof e&&"number"==typeof t&&Number.isFinite(e)&&Number.isFinite(t)?this.state.lastOrbitDistance=Math.max(0,t-e):"number"==typeof r&&Number.isFinite(r)?this.state.lastOrbitDistance=Math.max(0,r):this.state.lastOrbitDistance=void 0}else this.state.lastOrbitDistance=void 0;let e=this.getAbsoluteRotation(this.initialBlock.controlObjectData);for(let t of(e&&(this.state.lastAbsYaw=e.yaw,this.state.lastAbsPitch=e.pitch,this.state.yawOffset=e.yaw,this.state.pitchOffset=e.pitch),this.state.exhausted=!1,this.state.latestFov=100,this.state.latestControl={ghostIndex:this.initialBlock.controlObjectGhostIndex,data:this.initialBlock.controlObjectData,position:fk(this.initialBlock.controlObjectData?.position)?this.initialBlock.controlObjectData?.position:void 0},this.state.controlPlayerGhostId="player"===this.state.lastControlType&&this.initialBlock.controlObjectGhostIndex>=0?`player_${this.initialBlock.controlObjectGhostIndex}`:void 0,this.state.camera=null,this.state.lastStatus={health:1,energy:1},this.state.nextExplosionId=0,this.initialBlock.initialGhosts)){if("create"!==t.type||null==t.classId)continue;let e=this.registry.getGhostParser(t.classId)?.name??`ghost_${t.classId}`,r=fG(e,t.index),a={id:r,ghostIndex:t.index,className:e,spawnTick:0,type:fP(e),rotation:[0,0,0,1]};this.applyGhostData(a,t.parsedData),this.state.entitiesById.set(r,a),this.state.entityIdByGhostIndex.set(t.index,r)}this.updateCameraAndHud()}getSnapshot(){return this.buildSnapshot()}getEffectShapes(){let e=new Set;for(let[,t]of this.initialBlock.dataBlocks){let r=t.data?.explosion;if(null==r)continue;let a=this.getDataBlockData(r),n=a?.dtsFileName;n&&e.add(n)}return[...e]}stepToTime(e,t=1/0){let r=Math.floor(1e3*(Number.isFinite(e)?Math.max(0,e):0)/32);r0&&(this.state.playerSensorGroup=t.sensorGroup)}if(r){let e=fH(r);if(e&&(this.state.lastControlType=e),"player"===this.state.lastControlType)this.state.isPiloting=!!(r.pilot||null!=r.controlObjectGhost);else if(this.state.isPiloting=!1,"number"==typeof r.cameraMode)if(this.state.lastCameraMode=r.cameraMode,3===r.cameraMode){"number"==typeof r.orbitObjectGhostIndex&&(this.state.lastOrbitGhostIndex=r.orbitObjectGhostIndex);let e=r.minOrbitDist,t=r.maxOrbitDist,a=r.curOrbitDist;"number"==typeof e&&"number"==typeof t&&Number.isFinite(e)&&Number.isFinite(t)?this.state.lastOrbitDistance=Math.max(0,t-e):"number"==typeof a&&Number.isFinite(a)&&(this.state.lastOrbitDistance=Math.max(0,a))}else this.state.lastOrbitGhostIndex=void 0,this.state.lastOrbitDistance=void 0}for(let e of t.events){let t=this.registry.getEventParser(e.classId)?.name;if("NetStringEvent"===t&&e.parsedData){let t=e.parsedData.id,r=e.parsedData.value;null!=t&&"string"==typeof r&&this.netStrings.set(t,r);continue}if("TargetInfoEvent"===t&&e.parsedData){let t=e.parsedData.targetId,r=e.parsedData.nameTag;if(null!=t&&null!=r){let e=this.netStrings.get(r);e&&this.targetNames.set(t,fR(e))}let a=e.parsedData.sensorGroup;null!=t&&null!=a&&this.targetTeams.set(t,a)}else if("SetSensorGroupEvent"===t&&e.parsedData){let t=e.parsedData.sensorGroup;null!=t&&(this.state.playerSensorGroup=t)}else if("SensorGroupColorEvent"===t&&e.parsedData){let t=e.parsedData.sensorGroup,r=e.parsedData.colors;if(r){let e=this.sensorGroupColors.get(t);for(let a of(e||(e=new Map,this.sensorGroupColors.set(t,e)),r))a.default?e.delete(a.index):e.set(a.index,{r:a.r??0,g:a.g??0,b:a.b??0})}}}for(let e of t.ghosts)this.applyPacketGhost(e);return}if(3===e.type&&this.isInfoData(e.parsed)){Number.isFinite(e.parsed.value2)&&(this.state.latestFov=e.parsed.value2);return}2===e.type&&this.isMoveData(e.parsed)&&(this.state.moveYawAccum+=e.parsed.yaw??0,this.state.movePitchAccum+=e.parsed.pitch??0)}applyPacketGhost(e){let t=e.index,r=this.state.entityIdByGhostIndex.get(t);if("delete"===e.type){r&&(this.state.entitiesById.delete(r),this.state.entityIdByGhostIndex.delete(t));return}let a=this.resolveGhostClassName(t,e.classId);if(!a)return;let n=fG(a,t);r&&r!==n&&this.state.entitiesById.delete(r);let i=this.state.entitiesById.get(n);i||(i={id:n,ghostIndex:t,className:a,spawnTick:this.state.moveTicks,type:fP(a),rotation:[0,0,0,1]},this.state.entitiesById.set(n,i)),i.ghostIndex=t,i.className=a,i.type=fP(a),this.state.entityIdByGhostIndex.set(t,n),this.applyGhostData(i,e.parsedData)}resolveGhostClassName(e,t){if("number"==typeof t){let e=this.registry.getGhostParser(t)?.name;if(e)return e}let r=this.state.entityIdByGhostIndex.get(e);if(r){let e=this.state.entitiesById.get(r);if(e?.className)return e.className}let a=this.parser.getGhostTracker().getGhost(e);if(a?.className)return a.className}resolveEntityIdForGhostIndex(e){let t=this.state.entityIdByGhostIndex.get(e);if(t)return t;let r=this.parser.getGhostTracker().getGhost(e);if(r)return fG(r.className,e)}getDataBlockData(e){let t=this.initialBlock.dataBlocks.get(e);if(t?.data)return t.data;let r=this.parser.getPacketParser();return r.dataBlockDataMap?.get(e)}resolveExplosionInfo(e){let t=this.getDataBlockData(e),r=t?.explosion;if(null==r)return;let a=this.getDataBlockData(r);if(!a)return;let n=a.dtsFileName;if(!n)return;let i=a.lifetimeMS??31;return{shape:n,faceViewer:!1!==a.faceViewer&&0!==a.faceViewer,lifetimeTicks:i}}applyGhostData(e,t){if(!t)return;let r=t.dataBlockId;if(null!=r){e.dataBlockId=r;let t=this.getDataBlockData(r),a=f_(t);if(e.visual=function(e,t){if(!t)return;let r=fU(t,["tracerTex0","textureName0","texture0"])??"";if(!("TracerProjectile"===e||r.length>0&&null!=fO(t,["tracerLength"]))||!r)return;let a=fU(t,["tracerTex1","textureName1","texture1"]),n=fO(t,["tracerLength"])??10,i=fO(t,["tracerWidth"]),o=fO(t,["tracerAlpha"]),s=null!=i&&(null!=fO(t,["crossViewAng"])||i<=.7)?i:o??i??.5,l=fO(t,["crossViewAng","crossViewFraction"])??("number"==typeof t.tracerWidth&&t.tracerWidth>.7?t.tracerWidth:.98);return{kind:"tracer",texture:r,crossTexture:a,tracerLength:n,tracerWidth:s,crossViewAng:l,crossSize:fO(t,["crossSize","muzzleVelocity"])??.45,renderCross:function(e,t){if(e)for(let r of t){let t=e[r];if("boolean"==typeof t)return t}}(t,["renderCross","proximityRadius"])??!0}}(e.className,t)??function(e,t){if(t){if("LinearFlareProjectile"===e){let e=fU(t,["smokeTexture","flareTexture"]);if(!e)return;let r=t.flareColor,a=fO(t,["size"])??.5;return{kind:"sprite",texture:e,color:r?{r:r.r,g:r.g,b:r.b}:{r:1,g:1,b:1},size:a}}if("FlareProjectile"===e){let e=fU(t,["flareTexture"]);if(!e)return;return{kind:"sprite",texture:e,color:{r:1,g:.9,b:.5},size:fO(t,["size"])??4}}}}(e.className,t),"string"==typeof a&&(e.shapeHint=a,e.dataBlock=a),"Player"===e.type&&"number"==typeof t?.maxEnergy&&(e.maxEnergy=t.maxEnergy),"Projectile"===e.type&&(fb.has(e.className)?e.projectilePhysics="linear":fC.has(e.className)?(e.projectilePhysics="ballistic",e.gravityMod=fO(t,["gravityMod"])??1):fB.has(e.className)&&(e.projectilePhysics="seeker")),"Projectile"===e.type&&!e.explosionShape){let t=this.resolveExplosionInfo(r);t&&(e.explosionShape=t.shape,e.faceViewer=t.faceViewer,e.explosionLifetimeTicks=t.lifetimeTicks)}}if("Player"===e.type){let r=t.images;if(Array.isArray(r)&&r.length>0){let t=r[0];if(t?.dataBlockId&&t.dataBlockId>0){let r=this.getDataBlockData(t.dataBlockId),a=f_(r);if(a){let t=r?.mountPoint;(null==t||t<=0)&&!/pack_/i.test(a)&&(e.weaponShape=a)}}}}let a=fk(t.position)?t.position:fk(t.initialPosition)?t.initialPosition:fk(t.explodePosition)?t.explodePosition:fk(t.endPoint)?t.endPoint:fk(t.transform?.position)?t.transform.position:void 0;a&&(e.position=[a.x,a.y,a.z]);let n=fj(t.direction)?t.direction:void 0;if(n&&(e.direction=[n.x,n.y,n.z]),"Player"===e.type&&"number"==typeof t.rotationZ)e.rotation=fI(t.rotationZ);else if(fL(t.angPosition)){let r=fT(t.angPosition);r&&(e.rotation=r)}else if(fL(t.transform?.rotation)){let r=fT(t.transform.rotation);r&&(e.rotation=r)}else if("Item"===e.type&&"number"==typeof t.rotation?.angle){let r=t.rotation;e.rotation=fI((r.zSign??1)*r.angle)}else if("Projectile"===e.type){let r=t.velocity??t.direction??(fk(t.initialPosition)&&fk(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);fj(r)&&(0!==r.x||0!==r.y)&&(e.rotation=fI(Math.atan2(r.x,r.y)))}if(fj(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])),e.projectilePhysics){if("linear"===e.projectilePhysics){let r=fO(null!=e.dataBlockId?this.getDataBlockData(e.dataBlockId):void 0,["dryVelocity","muzzleVelocity","bulletVelocity"])??80,a=e.direction??[0,1,0],n=a[0]*r,i=a[1]*r,o=a[2]*r,s=t.excessVel,l=t.excessDir;"number"==typeof s&&s>0&&fj(l)&&(n+=l.x*s,i+=l.y*s,o+=l.z*s),e.simulatedVelocity=[n,i,o]}else e.velocity&&(e.simulatedVelocity=[e.velocity[0],e.velocity[1],e.velocity[2]]);let r=t.currTick;if("number"==typeof r&&r>0&&e.simulatedVelocity&&e.position){let t=.032*r,a=e.simulatedVelocity;if(e.position[0]+=a[0]*t,e.position[1]+=a[1]*t,e.position[2]+=a[2]*t,"ballistic"===e.projectilePhysics){let r=9.81*(e.gravityMod??1);e.position[2]-=.5*r*t*t,a[2]-=r*t}}}let i=fk(t.explodePosition)?t.explodePosition:fk(t.explodePoint)?t.explodePoint:void 0;if("Projectile"===e.type&&!e.hasExploded&&i&&e.explosionShape){e.hasExploded=!0;let t=`fx_${this.state.nextExplosionId++}`,r=e.explosionLifetimeTicks??31,a={id:t,ghostIndex:-1,className:"Explosion",spawnTick:this.state.moveTicks,type:"Explosion",dataBlock:e.explosionShape,position:[i.x,i.y,i.z],rotation:[0,0,0,1],isExplosion:!0,faceViewer:!1!==e.faceViewer,expiryTick:this.state.moveTicks+r};this.state.entitiesById.set(t,a),e.position=void 0,e.simulatedVelocity=void 0}if("number"==typeof t.damageLevel&&(e.health=fw(1-t.damageLevel,0,1)),"number"==typeof t.energy&&(e.energy=fw(t.energy,0,1)),"number"==typeof t.targetId){e.targetId=t.targetId;let r=this.targetNames.get(t.targetId);r&&(e.playerName=r);let a=this.targetTeams.get(t.targetId);null!=a&&(e.sensorGroup=a,e.ghostIndex===this.state.latestControl.ghostIndex&&"player"===this.state.lastControlType&&(this.state.playerSensorGroup=a))}}advanceProjectiles(){for(let e of this.state.entitiesById.values()){if(!e.simulatedVelocity||!e.position)continue;let t=e.simulatedVelocity,r=e.position;if("ballistic"===e.projectilePhysics){let r=9.81*(e.gravityMod??1);t[2]-=.032*r}r[0]+=.032*t[0],r[1]+=.032*t[1],r[2]+=.032*t[2],(0!==t[0]||0!==t[1])&&(e.rotation=fI(Math.atan2(t[0],t[1])))}}removeExpiredExplosions(){for(let[e,t]of this.state.entitiesById)t.isExplosion&&null!=t.expiryTick&&this.state.moveTicks>=t.expiryTick&&this.state.entitiesById.delete(e)}updateCameraAndHud(){let e=this.state.latestControl,t=.032*this.state.moveTicks,r=e.data,a=this.state.lastControlType;if(e.position){var n,i;let o,s,l,u,c=this.getAbsoluteRotation(r),d=!this.state.isPiloting&&"player"===a,f=d?this.state.moveYawAccum+this.state.yawOffset:this.state.lastAbsYaw,h=d?this.state.movePitchAccum+this.state.pitchOffset:this.state.lastAbsPitch,m=f,p=h;if(c?(m=c.yaw,p=c.pitch,this.state.lastAbsYaw=m,this.state.lastAbsPitch=p,this.state.yawOffset=m-this.state.moveYawAccum,this.state.pitchOffset=p-this.state.movePitchAccum):d?(this.state.lastAbsYaw=m,this.state.lastAbsPitch=p):(m=this.state.lastAbsYaw,p=this.state.lastAbsPitch),this.state.camera={time:t,position:[e.position.x,e.position.y,e.position.z],rotation:(n=m,o=Math.sin(i=fw(p,-fE,fE)),s=Math.cos(i),l=Math.sin(n),u=Math.cos(n),fM.set(-l,u*o,-u*s,0,0,s,o,0,u,l*o,-l*s,0,0,0,0,1),fD.setFromRotationMatrix(fM),[fD.x,fD.y,fD.z,fD.w]),fov:this.state.latestFov,mode:"observer",yaw:m,pitch:p},"camera"===a)if(("number"==typeof r?.cameraMode?r.cameraMode:this.state.lastCameraMode)===3){this.state.camera.mode="third-person","number"==typeof this.state.lastOrbitDistance&&(this.state.camera.orbitDistance=this.state.lastOrbitDistance);let e="number"==typeof r?.orbitObjectGhostIndex?r.orbitObjectGhostIndex:this.state.lastOrbitGhostIndex;"number"==typeof e&&e>=0&&(this.state.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(e))}else this.state.camera.mode="observer";else this.state.camera.mode="first-person",e.ghostIndex>=0&&(this.state.controlPlayerGhostId=`player_${e.ghostIndex}`),this.state.controlPlayerGhostId&&(this.state.camera.controlEntityId=this.state.controlPlayerGhostId);if("player"===a&&!this.state.isPiloting&&this.state.controlPlayerGhostId&&e.position){let t=this.state.entitiesById.get(this.state.controlPlayerGhostId);t&&(t.position=[e.position.x,e.position.y,e.position.z],t.rotation=fI(m))}}else this.state.camera&&(this.state.camera={...this.state.camera,time:t,fov:this.state.latestFov});let o={health:1,energy:1};if(this.state.camera?.mode==="first-person"){let e=this.state.controlPlayerGhostId,t=e?this.state.entitiesById.get(e):void 0;o.health=t?.health??1;let a=r?.energyLevel;if("number"==typeof a){let e=t?.maxEnergy??60;e>0&&(o.energy=fw(a/e,0,1))}else o.energy=t?.energy??1}else if(this.state.camera?.mode==="third-person"&&this.state.camera.orbitTargetId){let e=this.state.entitiesById.get(this.state.camera.orbitTargetId);o.health=e?.health??1,o.energy=e?.energy??1}this.state.lastStatus=o}buildSnapshot(){let e=[];for(let t of this.state.entitiesById.values())(t.spawnTick>0||!fx.has(t.className))&&e.push({id:t.id,type:t.type,visual:t.visual,direction:t.direction,ghostIndex:t.ghostIndex,className:t.className,dataBlockId:t.dataBlockId,shapeHint:t.shapeHint,dataBlock:t.dataBlock,weaponShape:t.weaponShape,playerName:t.playerName,iffColor:"Player"===t.type&&null!=t.sensorGroup?this.resolveIffColor(t.sensorGroup):void 0,position:t.position?[...t.position]:void 0,rotation:t.rotation?[...t.rotation]:void 0,velocity:t.velocity,health:t.health,energy:t.energy,faceViewer:t.faceViewer});return{timeSec:.032*this.state.moveTicks,exhausted:this.state.exhausted,camera:this.state.camera,entities:e,controlPlayerGhostId:this.state.controlPlayerGhostId,status:this.state.lastStatus}}resolveIffColor(e){if(0===this.state.playerSensorGroup)return;let t=this.sensorGroupColors.get(this.state.playerSensorGroup);if(t){let r=t.get(e);if(r)return r}return e===this.state.playerSensorGroup?fv:0!==e?fy:void 0}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}isPacketData(e){return!!e&&"object"==typeof e&&"gameState"in e&&"events"in e&&"ghosts"in e}isMoveData(e){return!!e&&"object"==typeof e&&"yaw"in e}isInfoData(e){return!!e&&"object"==typeof e&&"value2"in e&&"number"==typeof e.value2}}async function fJ(e){let t=new fg(new Uint8Array(e)),{header:r,initialBlock:a}=await t.load(),{missionName:n,gameType:i}=function(e){let t=null,r=null;for(let a=0;a{if(f){p.current=p.current+1,h(null);return}m.current?.click()},d[0]=f,d[1]=h,d[2]=e):e=d[2];let g=e;d[3]!==h?(t=async e=>{let t=e.target.files?.[0];if(t){e.target.value="";try{let e=await t.arrayBuffer(),r=p.current+1;p.current=r;let a=await fJ(e);if(p.current!==r)return;h(a)}catch(e){console.error("Failed to load demo:",e)}}},d[3]=h,d[4]=t):t=d[4];let v=t;d[5]===Symbol.for("react.memo_cache_sentinel")?(r={display:"none"},d[5]=r):r=d[5],d[6]!==v?(a=(0,n.jsx)("input",{ref:m,type:"file",accept:".rec",style:r,onChange:v}),d[6]=v,d[7]=a):a=d[7];let y=f?"Unload demo":"Load demo (.rec)",A=f?"Unload demo":"Load demo (.rec)",F=f?"true":void 0;d[8]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)(lo,{className:"DemoIcon"}),d[8]=s):s=d[8];let b=f?"Unload demo":"Demo";return d[9]!==b?(l=(0,n.jsx)("span",{className:"ButtonLabel",children:b}),d[9]=b,d[10]=l):l=d[10],d[11]!==g||d[12]!==y||d[13]!==A||d[14]!==F||d[15]!==l?(u=(0,n.jsxs)("button",{type:"button",className:"IconButton LabelledButton","aria-label":y,title:A,onClick:g,"data-active":F,children:[s,l]}),d[11]=g,d[12]=y,d[13]=A,d[14]=F,d[15]=l,d[16]=u):u=d[16],d[17]!==u||d[18]!==a?(c=(0,n.jsxs)(n.Fragment,{children:[a,u]}),d[17]=u,d[18]=a,d[19]=c):c=d[19],c}function fV(e){return(0,la.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}function fz(e){return(0,la.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(e)}function fq(e){let t,r,a,s,l,u,c,d,f,h,m,p,g,v,y,A,F,b,C,B,S,x,M,D,k,w,I,T,R,P,G,L,j,_,O,U,H,N,J,K,V,z,q,Q,W,X=(0,i.c)(103),{missionName:Y,missionType:Z,onChangeMission:$,onOpenMapInfo:ee,cameraRef:et,isTouch:er}=e,{fogEnabled:ea,setFogEnabled:en,fov:ei,setFov:eo,audioEnabled:es,setAudioEnabled:el,animationEnabled:eu,setAnimationEnabled:ec}=(0,E.useSettings)(),{speedMultiplier:ed,setSpeedMultiplier:ef,touchMode:eh,setTouchMode:em}=(0,E.useControls)(),{debugMode:ep,setDebugMode:eg}=(0,E.useDebug)(),ev=null!=r$(),[ey,eA]=(0,o.useState)(!1),eF=(0,o.useRef)(null),eb=(0,o.useRef)(null),eC=(0,o.useRef)(null);X[0]!==ey?(t=()=>{ey&&eF.current?.focus()},r=[ey],X[0]=ey,X[1]=t,X[2]=r):(t=X[1],r=X[2]),(0,o.useEffect)(t,r),X[3]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{let t=e.relatedTarget;t&&eC.current?.contains(t)||eA(!1)},X[3]=a):a=X[3];let eB=a;X[4]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(eA(!1),eb.current?.focus())},X[4]=s):s=X[4];let eS=s;return X[5]!==ev||X[6]!==Y||X[7]!==Z||X[8]!==$?(l=(0,n.jsx)(lt,{value:Y,missionType:Z,onChange:$,disabled:ev}),X[5]=ev,X[6]=Y,X[7]=Z,X[8]=$,X[9]=l):l=X[9],X[10]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{eA(fQ)},X[10]=u):u=X[10],X[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)(fz,{}),X[11]=c):c=X[11],X[12]!==ey?(d=(0,n.jsx)("button",{ref:eb,className:"IconButton Controls-toggle",onClick:u,"aria-expanded":ey,"aria-controls":"settingsPanel","aria-label":"Settings",children:c}),X[12]=ey,X[13]=d):d=X[13],X[14]!==et||X[15]!==Y||X[16]!==Z?(f=(0,n.jsx)(li,{cameraRef:et,missionName:Y,missionType:Z}),X[14]=et,X[15]=Y,X[16]=Z,X[17]=f):f=X[17],X[18]===Symbol.for("react.memo_cache_sentinel")?(h=(0,n.jsx)(fK,{}),X[18]=h):h=X[18],X[19]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(fV,{}),p=(0,n.jsx)("span",{className:"ButtonLabel",children:"Show map info"}),X[19]=m,X[20]=p):(m=X[19],p=X[20]),X[21]!==ee?(g=(0,n.jsxs)("button",{type:"button",className:"IconButton LabelledButton MapInfoButton","aria-label":"Show map info",onClick:ee,children:[m,p]}),X[21]=ee,X[22]=g):g=X[22],X[23]!==g||X[24]!==f?(v=(0,n.jsxs)("div",{className:"Controls-group",children:[f,h,g]}),X[23]=g,X[24]=f,X[25]=v):v=X[25],X[26]!==en?(y=e=>{en(e.target.checked)},X[26]=en,X[27]=y):y=X[27],X[28]!==ea||X[29]!==y?(A=(0,n.jsx)("input",{id:"fogInput",type:"checkbox",checked:ea,onChange:y}),X[28]=ea,X[29]=y,X[30]=A):A=X[30],X[31]===Symbol.for("react.memo_cache_sentinel")?(F=(0,n.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),X[31]=F):F=X[31],X[32]!==A?(b=(0,n.jsxs)("div",{className:"CheckboxField",children:[A,F]}),X[32]=A,X[33]=b):b=X[33],X[34]!==el?(C=e=>{el(e.target.checked)},X[34]=el,X[35]=C):C=X[35],X[36]!==es||X[37]!==C?(B=(0,n.jsx)("input",{id:"audioInput",type:"checkbox",checked:es,onChange:C}),X[36]=es,X[37]=C,X[38]=B):B=X[38],X[39]===Symbol.for("react.memo_cache_sentinel")?(S=(0,n.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),X[39]=S):S=X[39],X[40]!==B?(x=(0,n.jsxs)("div",{className:"CheckboxField",children:[B,S]}),X[40]=B,X[41]=x):x=X[41],X[42]!==b||X[43]!==x?(M=(0,n.jsxs)("div",{className:"Controls-group",children:[b,x]}),X[42]=b,X[43]=x,X[44]=M):M=X[44],X[45]!==ec?(D=e=>{ec(e.target.checked)},X[45]=ec,X[46]=D):D=X[46],X[47]!==eu||X[48]!==D?(k=(0,n.jsx)("input",{id:"animationInput",type:"checkbox",checked:eu,onChange:D}),X[47]=eu,X[48]=D,X[49]=k):k=X[49],X[50]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),X[50]=w):w=X[50],X[51]!==k?(I=(0,n.jsxs)("div",{className:"CheckboxField",children:[k,w]}),X[51]=k,X[52]=I):I=X[52],X[53]!==eg?(T=e=>{eg(e.target.checked)},X[53]=eg,X[54]=T):T=X[54],X[55]!==ep||X[56]!==T?(R=(0,n.jsx)("input",{id:"debugInput",type:"checkbox",checked:ep,onChange:T}),X[55]=ep,X[56]=T,X[57]=R):R=X[57],X[58]===Symbol.for("react.memo_cache_sentinel")?(P=(0,n.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),X[58]=P):P=X[58],X[59]!==R?(G=(0,n.jsxs)("div",{className:"CheckboxField",children:[R,P]}),X[59]=R,X[60]=G):G=X[60],X[61]!==I||X[62]!==G?(L=(0,n.jsxs)("div",{className:"Controls-group",children:[I,G]}),X[61]=I,X[62]=G,X[63]=L):L=X[63],X[64]===Symbol.for("react.memo_cache_sentinel")?(j=(0,n.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),X[64]=j):j=X[64],X[65]!==eo?(_=e=>eo(parseInt(e.target.value)),X[65]=eo,X[66]=_):_=X[66],X[67]!==ei||X[68]!==ev||X[69]!==_?(O=(0,n.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:ei,disabled:ev,onChange:_}),X[67]=ei,X[68]=ev,X[69]=_,X[70]=O):O=X[70],X[71]!==ei?(U=(0,n.jsx)("output",{htmlFor:"fovInput",children:ei}),X[71]=ei,X[72]=U):U=X[72],X[73]!==O||X[74]!==U?(H=(0,n.jsxs)("div",{className:"Field",children:[j,O,U]}),X[73]=O,X[74]=U,X[75]=H):H=X[75],X[76]===Symbol.for("react.memo_cache_sentinel")?(N=(0,n.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),X[76]=N):N=X[76],X[77]!==ef?(J=e=>ef(parseFloat(e.target.value)),X[77]=ef,X[78]=J):J=X[78],X[79]!==ev||X[80]!==ed||X[81]!==J?(K=(0,n.jsxs)("div",{className:"Field",children:[N,(0,n.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:ed,disabled:ev,onChange:J})]}),X[79]=ev,X[80]=ed,X[81]=J,X[82]=K):K=X[82],X[83]!==H||X[84]!==K?(V=(0,n.jsxs)("div",{className:"Controls-group",children:[H,K]}),X[83]=H,X[84]=K,X[85]=V):V=X[85],X[86]!==er||X[87]!==em||X[88]!==eh?(z=er&&(0,n.jsx)("div",{className:"Controls-group",children:(0,n.jsxs)("div",{className:"Field",children:[(0,n.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick:"})," ",(0,n.jsxs)("select",{id:"touchModeInput",value:eh,onChange:e=>em(e.target.value),children:[(0,n.jsx)("option",{value:"dualStick",children:"Dual Stick"}),(0,n.jsx)("option",{value:"moveLookStick",children:"Single Stick"})]})]})}),X[86]=er,X[87]=em,X[88]=eh,X[89]=z):z=X[89],X[90]!==ey||X[91]!==v||X[92]!==M||X[93]!==L||X[94]!==V||X[95]!==z?(q=(0,n.jsxs)("div",{className:"Controls-dropdown",ref:eF,id:"settingsPanel",tabIndex:-1,onKeyDown:eS,onBlur:eB,"data-open":ey,children:[v,M,L,V,z]}),X[90]=ey,X[91]=v,X[92]=M,X[93]=L,X[94]=V,X[95]=z,X[96]=q):q=X[96],X[97]!==q||X[98]!==d?(Q=(0,n.jsxs)("div",{ref:eC,children:[d,q]}),X[97]=q,X[98]=d,X[99]=Q):Q=X[99],X[100]!==Q||X[101]!==l?(W=(0,n.jsxs)("div",{id:"controls",onKeyDown:fY,onPointerDown:fX,onClick:fW,children:[l,Q]}),X[100]=Q,X[101]=l,X[102]=W):W=X[102],W}function fQ(e){return!e}function fW(e){return e.stopPropagation()}function fX(e){return e.stopPropagation()}function fY(e){return e.stopPropagation()}let fZ=()=>null,f$=o.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:a,children:n,...i},s)=>{let l=(0,F.useThree)(({set:e})=>e),c=(0,F.useThree)(({camera:e})=>e),d=(0,F.useThree)(({size:e})=>e),f=o.useRef(null);o.useImperativeHandle(s,()=>f.current,[]);let h=o.useRef(null),m=function(e,t,r){let a=(0,F.useThree)(e=>e.size),n=(0,F.useThree)(e=>e.viewport),i="number"==typeof e?e:a.width*n.dpr,s=a.height*n.dpr,l=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:d,...f}=l,h=null!=d?d:l.depthBuffer,m=o.useMemo(()=>{let e=new u.WebGLRenderTarget(i,s,{minFilter:u.LinearFilter,magFilter:u.LinearFilter,type:u.HalfFloatType,...f});return h&&(e.depthTexture=new u.DepthTexture(i,s,u.FloatType)),e.samples=c,e},[]);return o.useLayoutEffect(()=>{m.setSize(i,s),c&&(m.samples=c)},[c,m,i,s]),o.useEffect(()=>()=>m.dispose(),[]),m}(t);o.useLayoutEffect(()=>{i.manual||(f.current.aspect=d.width/d.height)},[d,i]),o.useLayoutEffect(()=>{f.current.updateProjectionMatrix()});let p=0,g=null,v="function"==typeof n;return(0,A.useFrame)(t=>{v&&(r===1/0||p{if(a)return l(()=>({camera:f.current})),()=>l(()=>({camera:c}))},[f,a,l]),o.createElement(o.Fragment,null,o.createElement("perspectiveCamera",(0,W.default)({ref:f},i),!v&&n),o.createElement("group",{ref:h},v&&n(m.texture)))});function f0(){let e,t,r=(0,i.c)(3),{fov:a}=(0,E.useSettings)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],r[0]=e):e=r[0],r[1]!==a?(t=(0,n.jsx)(f$,{makeDefault:!0,position:e,fov:a}),r[1]=a,r[2]=t):t=r[2],t}var f1=e.i(51434),f2=e.i(81405);function f3(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function f9({showPanel:e=0,className:t,parent:r}){let a=function(e,t=[],r){let[a,n]=o.useState();return o.useLayoutEffect(()=>{let t=e();return n(t),f3(void 0,t),()=>f3(void 0,null)},t),a}(()=>new f2.default,[]);return o.useEffect(()=>{if(a){let n=r&&r.current||document.body;a.showPanel(e),null==n||n.appendChild(a.dom);let i=(null!=t?t:"").split(" ").filter(e=>e);i.length&&a.dom.classList.add(...i);let o=(0,s.j)(()=>a.begin()),l=(0,s.k)(()=>a.end());return()=>{i.length&&a.dom.classList.remove(...i),null==n||n.removeChild(a.dom),o(),l()}}},[r,a,t,e]),null}var f5=e.i(60099);function f8(){let e,t,r=(0,i.c)(3),{debugMode:a}=(0,E.useDebug)(),s=(0,o.useRef)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=s.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},r[0]=e):e=r[0],(0,o.useEffect)(e),r[1]!==a?(t=a?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f9,{className:"StatsPanel"}),(0,n.jsx)("axesHelper",{ref:s,args:[70],renderOrder:999,children:(0,n.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,n.jsx)(f5.Html,{position:[80,0,0],center:!0,children:(0,n.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,n.jsx)(f5.Html,{position:[0,80,0],center:!0,children:(0,n.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,n.jsx)(f5.Html,{position:[0,0,80],center:!0,children:(0,n.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null,r[1]=a,r[2]=t):t=r[2],t}var f4=o;let f6=new u.Vector3,f7=new u.Quaternion,he=new u.Quaternion,ht=new u.Quaternion,hr=new u.Vector3,ha=new u.Vector3,hn=new u.Vector3,hi=new u.Vector3,ho=new u.Raycaster,hs=new u.Vector3,hl=new u.Vector3,hu=new u.Vector3,hc=new u.Vector3,hd=new u.Vector3,hf=new u.Vector3,hh=new u.Vector3,hm=new u.Vector3,hp=new u.Matrix4,hg=new u.Vector3(0,1,0),hv=new u.Quaternion().setFromAxisAngle(new u.Vector3(0,1,0),Math.PI/2),hy=hv.clone().invert();function hA(e,t){return 180*(2*Math.atan(Math.tan(Math.max(.01,Math.min(179.99,e))*Math.PI/180/2)/(Number.isFinite(t)&&t>1e-6?t:4/3)))/Math.PI}function hF(e){e.wrapS=u.ClampToEdgeWrapping,e.wrapT=u.ClampToEdgeWrapping,e.minFilter=u.LinearFilter,e.magFilter=u.LinearFilter,e.colorSpace=u.NoColorSpace,e.flipY=!1,e.needsUpdate=!0}function hb(e,t){return t.set(e[1],e[2],e[0])}function hC(e,t){if(0===e.length)return null;if(t<=e[0].time)return e[0];if(t>=e[e.length-1].time)return e[e.length-1];let r=0,a=e.length-1;for(;a-r>1;){let n=r+a>>1;e[n].time<=t?r=n:a=n}return e[r]}function hB(e,t,r){let a=e.clone(!0),n=t.find(e=>"Root"===e.name);if(n){let e=new u.AnimationMixer(a);e.clipAction(n).play(),e.setTime(0)}a.updateMatrixWorld(!0);let i=null,o=null;return(a.traverse(e=>{i||e.name!==r||(i=new u.Vector3,o=new u.Quaternion,e.getWorldPosition(i),e.getWorldQuaternion(o))}),i&&o)?{position:i,quaternion:o}:null}let hS=new u.TextureLoader;function hx(e,t){let r=e.userData?.resource_path,a=new Set(e.userData?.flag_names??[]);if(!r){let t=new u.MeshLambertMaterial({color:e.color,side:2,reflectivity:0});return tL(t),t}let n=(0,y.textureToUrl)(r),i=hS.load(n);(0,C.setupTexture)(i);let o=tj(e,i,a,!1,t);return Array.isArray(o)?o[1]:o}function hE(e){let t=null;e.traverse(e=>{!t&&e.skeleton&&(t=e.skeleton)});let r=t?tB(t):new Set;e.traverse(e=>{if(!e.isMesh)return;if(e.name.match(/^Hulk/i)||e.material?.name==="Unassigned"||(e.userData?.vis??1)<.01){e.visible=!1;return}if(e.geometry){let t=tS(e.geometry,r);!function(e){e.computeVertexNormals();let t=e.attributes.position,r=e.attributes.normal;if(!t||!r)return;let a=t.array,n=r.array,i=new Map;for(let e=0;e1){let t=0,r=0,a=0;for(let i of e)t+=n[3*i],r+=n[3*i+1],a+=n[3*i+2];let i=Math.sqrt(t*t+r*r+a*a);for(let o of(i>0&&(t/=i,r/=i,a/=i),e))n[3*o]=t,n[3*o+1]=r,n[3*o+2]=a}r.needsUpdate=!0}(t=t.clone()),e.geometry=t}let t=e.userData?.vis??1;Array.isArray(e.material)?e.material=e.material.map(e=>hx(e,t)):e.material&&(e.material=hx(e.material,t))})}function hM({recording:e}){let{gl:t,scene:r}=(0,F.useThree)(),a=(0,R.useEngineStoreApi)(),n=(0,f4.useRef)(null),i=(0,f4.useRef)(0);return(0,f4.useEffect)(()=>{a.getState().recordPlaybackDiagnosticEvent({kind:"recording.loaded",meta:{missionName:e.missionName??null,gameType:e.gameType??null,isMetadataOnly:!!e.isMetadataOnly,isPartial:!!e.isPartial,hasStreamingPlayback:!!e.streamingPlayback,durationSec:Number(e.duration.toFixed(3))}})},[a]),(0,f4.useEffect)(()=>{let e=t.domElement;if(!e)return;let r=()=>{try{let e=t.getContext();if(e&&"function"==typeof e.isContextLost)return!!e.isContextLost()}catch{}},n=e=>{e.preventDefault();let t=a.getState();t.setWebglContextLost(!0),t.recordPlaybackDiagnosticEvent({kind:"webgl.context.lost",message:"Renderer emitted webglcontextlost",meta:{contextLost:r()}}),console.error("[demo diagnostics] WebGL context lost")},i=()=>{let e=a.getState();e.setWebglContextLost(!1),e.recordPlaybackDiagnosticEvent({kind:"webgl.context.restored",message:"Renderer emitted webglcontextrestored",meta:{contextLost:r()}}),console.warn("[demo diagnostics] WebGL context restored")},o=e=>{a.getState().recordPlaybackDiagnosticEvent({kind:"webgl.context.creation_error",message:e.statusMessage??"Context creation error",meta:{contextLost:r()}}),console.error("[demo diagnostics] WebGL context creation error",e.statusMessage??"")};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",i,!1),e.addEventListener("webglcontextcreationerror",o,!1),()=>{e.removeEventListener("webglcontextlost",n,!1),e.removeEventListener("webglcontextrestored",i,!1),e.removeEventListener("webglcontextcreationerror",o,!1)}},[a,t]),(0,f4.useEffect)(()=>{let e=()=>{let e,o,{sceneObjects:s,visibleSceneObjects:l}=(e=0,o=0,r.traverse(t=>{e+=1,t.visible&&(o+=1)}),{sceneObjects:e,visibleSceneObjects:o}),u=Array.isArray(t.info.programs)?t.info.programs.length:0,c=performance.memory,d={t:Date.now(),geometries:t.info.memory.geometries,textures:t.info.memory.textures,programs:u,renderCalls:t.info.render.calls,renderTriangles:t.info.render.triangles,renderPoints:t.info.render.points,renderLines:t.info.render.lines,sceneObjects:s,visibleSceneObjects:l,jsHeapUsed:c?.usedJSHeapSize,jsHeapTotal:c?.totalJSHeapSize,jsHeapLimit:c?.jsHeapSizeLimit};a.getState().appendRendererSample(d);let f=n.current;if(n.current={geometries:d.geometries,textures:d.textures,programs:d.programs,sceneObjects:d.sceneObjects,visibleSceneObjects:d.visibleSceneObjects},!f)return;let h=d.t,m=d.geometries-f.geometries,p=d.textures-f.textures,g=d.programs-f.programs,v=d.sceneObjects-f.sceneObjects;h-i.current>=5e3&&(m>=200||p>=100||g>=20||v>=400)&&(i.current=h,a.getState().recordPlaybackDiagnosticEvent({kind:"renderer.resource.spike",message:"Detected large one-second renderer resource increase",meta:{geometryDelta:m,textureDelta:p,programDelta:g,sceneObjectDelta:v,geometries:d.geometries,textures:d.textures,programs:d.programs,sceneObjects:d.sceneObjects}}))};e();let o=window.setInterval(e,1e3);return()=>{window.clearInterval(o)}},[a,t,r]),null}function hD(){let e=(0,R.useEngineStoreApi)(),t=r$(),r=(0,f4.useRef)(null);return(r.current||(r.current=hj("DemoPlayback")),(0,f4.useEffect)(()=>{hT+=1;let a=Date.now();return e.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"DemoPlayback mounted",meta:{component:"DemoPlayback",phase:"mount",instanceId:r.current,mountCount:hT,unmountCount:hR,recordingMissionName:t?.missionName??null,recordingDurationSec:t?Number(t.duration.toFixed(3)):null,ts:a}}),console.info("[demo diagnostics] DemoPlayback mounted",{instanceId:r.current,mountCount:hT,unmountCount:hR,recordingMissionName:t?.missionName??null,mountedAt:a}),()=>{hR+=1;let a=Date.now();e.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"DemoPlayback unmounted",meta:{component:"DemoPlayback",phase:"unmount",instanceId:r.current,mountCount:hT,unmountCount:hR,recordingMissionName:t?.missionName??null,ts:a}}),console.info("[demo diagnostics] DemoPlayback unmounted",{instanceId:r.current,mountCount:hT,unmountCount:hR,recordingMissionName:t?.missionName??null,unmountedAt:a})}},[e]),t)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(hM,{recording:t}),t.isMetadataOnly||t.isPartial?(0,n.jsx)(h_,{recording:t}):(0,n.jsx)(hk,{recording:t})]}):null}function hk(e){let t,r,a,o,s,l,c,d,f,h,m,p,g,v,y=(0,i.c)(38),{recording:F}=e,b=(0,R.useEngineStoreApi)(),C=(0,f4.useRef)(null),B=(0,f4.useRef)(null),S=(0,f4.useRef)(0);y[0]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Vector3(0,2.1,0),y[0]=t):t=y[0];let x=(0,f4.useRef)(t);e:{let e,t,a;if(!F){let e;y[1]===Symbol.for("react.memo_cache_sentinel")?(e={cameraEntity:null,otherEntities:[]},y[1]=e):e=y[1],r=e;break e}y[2]!==F.entities?(e=F.entities.find(hI)??null,y[2]=F.entities,y[3]=e):e=y[3];let n=e;y[4]!==F.entities?(t=F.entities.filter(hw),y[4]=F.entities,y[5]=t):t=y[5];let i=t;y[6]!==n||y[7]!==i?(a={cameraEntity:n,otherEntities:i},y[6]=n,y[7]=i,y[8]=a):a=y[8],r=a}let{cameraEntity:E,otherEntities:M}=r;if(y[9]!==M){for(let e of(a=new Map,M))a.set(String(e.id),function(e){let{keyframes:t}=e,r=String(e.id),a=new Float32Array(t.length),n=new Float32Array(3*t.length),i=new Float32Array(4*t.length);for(let e=0;e{let e=C.current;if(!e||0===D.size){B.current=null;return}let t=new u.AnimationMixer(e);for(let[,e]of(B.current=t,D)){let r=t.clipAction(e);r.setLoop(u.LoopOnce,1),r.clampWhenFinished=!0,r.play()}return t.setTime(0),t.timeScale=0,()=>{t.stopAllAction(),B.current=null}},c=[D],y[18]=D,y[19]=l,y[20]=c):(l=y[19],c=y[20]),(0,f4.useEffect)(l,c),y[21]!==b?(d=()=>{S.current=b.getState().playback.timeMs/1e3,B.current&&B.current.setTime(S.current)},f=[b],y[21]=b,y[22]=d,y[23]=f):(d=y[22],f=y[23]),(0,f4.useEffect)(d,f),y[24]!==E||y[25]!==b||y[26]!==k||y[27]!==F?(h=(e,t)=>{let r=e.camera,a=b.getState(),n=a.playback,i=B.current,o=n.status,s=n.rate,l=n.timeMs/1e3;if(Math.abs(l-S.current)>5e-4&&(S.current=l,i&&i.setTime(l)),"playing"===o&&F){let e=t*s;S.current=S.current+e,S.current>=F.duration&&(S.current=F.duration,a.setPlaybackStatus("paused")),i&&(i.timeScale=1,i.update(e))}else i&&(i.timeScale=0);if(E&&E.keyframes.length>0){let e=function(e,t,r,a){let{keyframes:n}=e;if(0===n.length)return;if(t<=n[0].time){let e=n[0];return r.set(e.position[1],e.position[2],e.position[0]),a.set(...e.rotation),e.fov}if(t>=n[n.length-1].time){let e=n[n.length-1];return r.set(e.position[1],e.position[2],e.position[0]),a.set(...e.rotation),e.fov}let i=0,o=n.length-1;for(;o-i>1;){let e=i+o>>1;n[e].time<=t?i=e:o=e}let s=n[i],l=n[o],u=(t-s.time)/(l.time-s.time);return r.set(s.position[1],s.position[2],s.position[0]),f6.set(l.position[1],l.position[2],l.position[0]),r.lerp(f6,u),a.set(...s.rotation),f7.set(...l.rotation),a.slerp(f7,u),s.fov??l.fov}(E,S.current,r.position,r.quaternion);if("number"==typeof e&&Number.isFinite(e)&&"isPerspectiveCamera"in r&&r.isPerspectiveCamera){let t=hA(e,r.aspect);Math.abs(r.fov-t)>.01&&(r.fov=t,r.updateProjectionMatrix())}}let u=F?function(e,t){if(0===e.length||t=e[e.length-1].time)return e[e.length-1];let r=0,a=e.length-1;for(;a-r>1;){let n=r+a>>1;e[n].time<=t?r=n:a=n}return e[r]}(F.cameraModes,S.current):null;if(u?.mode==="first-person"&&C.current){let e=C.current.children.find(e=>e.name===u.controlEntityId);e?(f6.copy(x.current).applyQuaternion(e.quaternion),r.position.add(f6)):r.position.y=r.position.y+x.current.y}C.current&&k.size>0&&function(e,t,r){for(let a of e.children){let e=t.get(a.name);e&&(a.visible=r>=e.spawn&&(null==e.despawn||r.5&&a.setPlaybackTime(c)},y[24]=E,y[25]=b,y[26]=k,y[27]=F,y[28]=h):h=y[28],(0,A.useFrame)(h),y[29]!==M?(m=M.map(e=>(0,n.jsx)(hz,{entity:e,timeRef:S},e.id)),y[29]=M,y[30]=m):m=y[30],y[31]!==m?(p=(0,n.jsx)("group",{ref:C,children:m}),y[31]=m,y[32]=p):p=y[32],y[33]!==w?(g=w&&(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hY,{shapeName:w,eyeOffsetRef:x})}),y[33]=w,y[34]=g):g=y[34],y[35]!==p||y[36]!==g?(v=(0,n.jsxs)(tP,{children:[p,g]}),y[35]=p,y[36]=g,y[37]=v):v=y[37],v}function hw(e){return"Camera"!==e.type}function hI(e){return"Camera"===e.type}let hT=0,hR=0,hP=0,hG=0,hL=0;function hj(e){return hL+=1,`${e}-${hL}`}function h_({recording:e}){let t=(0,R.useEngineStoreApi)(),r=(0,f4.useRef)(null);r.current||(r.current=hj("StreamingDemoPlayback"));let a=(0,f4.useRef)(null),i=(0,f4.useRef)(0),o=(0,f4.useRef)(0),s=(0,f4.useRef)(null),l=(0,f4.useRef)(null),c=(0,f4.useRef)(new u.Vector3(0,2.1,0)),d=(0,f4.useRef)(e.streamingPlayback??null),f=(0,f4.useRef)(null),h=(0,f4.useRef)(""),m=(0,f4.useRef)(new Map),p=(0,f4.useRef)(0),g=(0,f4.useRef)(!1),[v,F]=(0,f4.useState)([]),[b,C]=(0,f4.useState)(null);(0,f4.useEffect)(()=>{hP+=1;let a=Date.now();return t.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"StreamingDemoPlayback mounted",meta:{component:"StreamingDemoPlayback",phase:"mount",instanceId:r.current,mountCount:hP,unmountCount:hG,recordingMissionName:e.missionName??null,recordingDurationSec:Number(e.duration.toFixed(3)),ts:a}}),console.info("[demo diagnostics] StreamingDemoPlayback mounted",{instanceId:r.current,mountCount:hP,unmountCount:hG,recordingMissionName:e.missionName??null,mountedAt:a}),()=>{hG+=1;let a=Date.now();t.getState().recordPlaybackDiagnosticEvent({kind:"component.lifecycle",message:"StreamingDemoPlayback unmounted",meta:{component:"StreamingDemoPlayback",phase:"unmount",instanceId:r.current,mountCount:hP,unmountCount:hG,recordingMissionName:e.missionName??null,ts:a}}),console.info("[demo diagnostics] StreamingDemoPlayback unmounted",{instanceId:r.current,mountCount:hP,unmountCount:hG,recordingMissionName:e.missionName??null,unmountedAt:a})}},[t]);let B=(0,f4.useCallback)(e=>{let r=m.current.size,a=function(e){let t=[];for(let r of e.entities){let e=r.visual?.kind==="tracer"?`tracer:${r.visual.texture}:${r.visual.crossTexture??""}:${r.visual.tracerLength}:${r.visual.tracerWidth}:${r.visual.crossViewAng}:${r.visual.crossSize}:${+!!r.visual.renderCross}`:r.visual?.kind==="sprite"?`sprite:${r.visual.texture}:${r.visual.color.r}:${r.visual.color.g}:${r.visual.color.b}:${r.visual.size}`:"";t.push(`${r.id}|${r.type}|${r.dataBlock??""}|${r.weaponShape??""}|${r.playerName??""}|${r.className??""}|${r.ghostIndex??""}|${r.dataBlockId??""}|${r.shapeHint??""}|${r.faceViewer?"fv":""}|${e}`)}return t.sort(),t.join(";")}(e),n=h.current!==a,i=new Map;for(let t of e.entities){var o,s,l,u,c,d,f,g,v;let r=m.current.get(t.id);r&&r.type===t.type&&r.dataBlock===t.dataBlock&&r.weaponShape===t.weaponShape&&r.className===t.className&&r.ghostIndex===t.ghostIndex&&r.dataBlockId===t.dataBlockId&&r.shapeHint===t.shapeHint||(o=t.id,s=t.type,l=t.dataBlock,u=t.visual,c=t.direction,d=t.weaponShape,f=t.playerName,g=t.className,v=t.ghostIndex,r={id:o,type:s,dataBlock:l,visual:u,direction:c,weaponShape:d,playerName:f,className:g,ghostIndex:v,dataBlockId:t.dataBlockId,shapeHint:t.shapeHint,keyframes:[{time:0,position:[0,0,0],rotation:[0,0,0,1]}]}),r.playerName=t.playerName,r.iffColor=t.iffColor,r.dataBlock=t.dataBlock,r.visual=t.visual,r.direction=t.direction,r.weaponShape=t.weaponShape,r.className=t.className,r.ghostIndex=t.ghostIndex,r.dataBlockId=t.dataBlockId,r.shapeHint=t.shapeHint,0===r.keyframes.length&&r.keyframes.push({time:e.timeSec,position:t.position??[0,0,0],rotation:t.rotation??[0,0,0,1]});let a=r.keyframes[0];a.time=e.timeSec,t.position&&(a.position=t.position),t.rotation&&(a.rotation=t.rotation),a.velocity=t.velocity,a.health=t.health,a.energy=t.energy,i.set(t.id,r)}if(m.current=i,n){h.current=a,F(Array.from(i.values()));let n=Date.now();n-p.current>=500&&(p.current=n,t.getState().recordPlaybackDiagnosticEvent({kind:"stream.entities.rebuild",message:"Renderable demo entity list was rebuilt",meta:{previousEntityCount:r,nextEntityCount:i.size,snapshotTimeSec:Number(e.timeSec.toFixed(3))}}))}let y=null;if(e.camera?.mode==="first-person"&&e.camera.controlEntityId){let t=i.get(e.camera.controlEntityId);t?.dataBlock&&(y=t.dataBlock)}C(e=>e===y?e:y)},[t]);return(0,f4.useEffect)(()=>{d.current=e.streamingPlayback??null,m.current=new Map,h.current="",f.current=null,i.current=0,o.current=0,s.current=null,l.current=null,g.current=!1;let r=d.current;if(!r)return void t.getState().setPlaybackStreamSnapshot(null);for(let e of(r.reset(),r.getEffectShapes()))e2.preload((0,y.shapeToUrl)(e));let a=r.getSnapshot();return i.current=a.timeSec,o.current=a.timeSec,s.current=a,l.current=a,B(a),t.getState().setPlaybackStreamSnapshot(a),f.current=a,()=>{t.getState().setPlaybackStreamSnapshot(null)}},[e,t,B]),(0,A.useFrame)((e,r)=>{let n=d.current;if(!n)return;let u=t.getState(),h=u.playback,m="playing"===h.status,p=h.timeMs/1e3,v=!m&&Math.abs(p-o.current)>5e-4,y=m&&Math.abs(p-i.current)>.05,A=v||y;A&&(o.current=p),m&&(o.current+=r*h.rate);let F=Math.max(1,Math.ceil(1e3*r*Math.max(h.rate,.01)/32)+2),b=o.current+.032,C=n.stepToTime(b,m&&!A?F:1/0),S=l.current;!S||C.timeSec.048?(s.current=C,l.current=C):C.timeSec!==S.timeSec&&(s.current=S,l.current=C);let x=l.current??C,E=s.current??x,M=x.timeSec-.032,D=Math.max(0,Math.min(1,(o.current-M)/.032));i.current=o.current,C.exhausted&&m&&(o.current=Math.min(o.current,C.timeSec)),B(x);let k=f.current;k&&x.timeSec===k.timeSec&&x.exhausted===k.exhausted&&x.status.health===k.status.health&&x.status.energy===k.status.energy&&x.camera?.mode===k.camera?.mode&&x.camera?.controlEntityId===k.camera?.controlEntityId&&x.camera?.orbitTargetId===k.camera?.orbitTargetId||(f.current=x,u.setPlaybackStreamSnapshot(x));let w=x.camera,I=w&&E.camera&&E.camera.mode===w.mode&&E.camera.controlEntityId===w.controlEntityId&&E.camera.orbitTargetId===w.orbitTargetId?E.camera:null;if(w){if(I){let t=I.position[0],r=I.position[1],a=I.position[2],n=w.position[0],i=w.position[1],o=w.position[2];e.camera.position.set(r+(i-r)*D,a+(o-a)*D,t+(n-t)*D),he.set(...I.rotation),ht.set(...w.rotation),he.slerp(ht,D),e.camera.quaternion.copy(he)}else e.camera.position.set(w.position[1],w.position[2],w.position[0]),e.camera.quaternion.set(...w.rotation);if(Number.isFinite(w.fov)&&"isPerspectiveCamera"in e.camera&&e.camera.isPerspectiveCamera){let t=e.camera,r=hA(I&&Number.isFinite(I.fov)?I.fov+(w.fov-I.fov)*D:w.fov,t.aspect);Math.abs(t.fov-r)>.01&&(t.fov=r,t.updateProjectionMatrix())}}let T=new Map(x.entities.map(e=>[e.id,e])),R=new Map(E.entities.map(e=>[e.id,e])),P=a.current;if(P)for(let t of P.children){let r=T.get(t.name);if(!r?.position){t.visible=!1;continue}t.visible=!0;let a=R.get(t.name);if(a?.position){let e=a.position[0],n=a.position[1],i=a.position[2],o=r.position[0],s=r.position[1],l=r.position[2],u=e+(o-e)*D,c=n+(s-n)*D,d=i+(l-i)*D;t.position.set(c,d,u)}else t.position.set(r.position[1],r.position[2],r.position[0]);r.faceViewer?t.quaternion.copy(e.camera.quaternion):r.visual?.kind==="tracer"?t.quaternion.identity():r.rotation&&(a?.rotation?(he.set(...a.rotation),ht.set(...r.rotation),he.slerp(ht,D),t.quaternion.copy(he)):t.quaternion.set(...r.rotation))}let G=w?.mode;if("third-person"===G&&P&&w?.orbitTargetId){let t=P.children.find(e=>e.name===w.orbitTargetId);if(t){let r=T.get(w.orbitTargetId);ha.copy(t.position),r?.type==="Player"&&(ha.y+=1);let a=!1;if("number"==typeof w.yaw&&"number"==typeof w.pitch){let e=Math.sin(w.pitch),t=Math.cos(w.pitch),r=Math.sin(w.yaw),n=Math.cos(w.yaw);hr.set(-t,-r*e,-n*e),a=hr.lengthSq()>1e-8}if(a||(hr.copy(e.camera.position).sub(ha),a=hr.lengthSq()>1e-8),a){hr.normalize();let t=Math.max(.1,w.orbitDistance??4);for(let r of(hn.copy(ha).addScaledVector(hr,t),ho.near=.001,ho.far=2.5*t,ho.camera=e.camera,ho.set(ha,hr),ho.intersectObjects(e.scene.children,!0))){if(r.distance<=1e-4||function(e,t){let r=e;for(;r;){if(r.name===t)return!0;r=r.parent}return!1}(r.object,w.orbitTargetId))continue;if(!r.face)break;hi.copy(r.face.normal).transformDirection(r.object.matrixWorld);let e=-hr.dot(hi);if(e>.01){let a=r.distance-.05/e;a>t&&(a=t),a<0&&(a=0),hn.copy(ha).addScaledVector(hr,a)}break}e.camera.position.copy(hn),e.camera.lookAt(ha)}}}if("first-person"===G&&P&&w?.controlEntityId){let t=P.children.find(e=>e.name===w.controlEntityId);t?(f6.copy(c.current).applyQuaternion(t.quaternion),e.camera.position.add(f6)):e.camera.position.y+=c.current.y}m&&C.exhausted?(g.current||(g.current=!0,u.recordPlaybackDiagnosticEvent({kind:"stream.exhausted",message:"Streaming playback reached end-of-stream while playing",meta:{streamTimeSec:Number(C.timeSec.toFixed(3)),requestedPlaybackSec:Number(o.current.toFixed(3))}})),u.setPlaybackStatus("paused")):C.exhausted||(g.current=!1);let L=1e3*o.current;Math.abs(L-h.timeMs)>.5&&u.setPlaybackTime(L)}),(0,n.jsxs)(tP,{children:[(0,n.jsx)("group",{ref:a,children:v.map(e=>(0,n.jsx)(hz,{entity:e,timeRef:i},e.id))}),b&&(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hY,{shapeName:b,eyeOffsetRef:c})})]})}function hO(e){let t,r,a,o,s,l=(0,i.c)(18),{entity:u,timeRef:c}=e,{camera:d}=(0,F.useThree)(),f=(0,f4.useRef)(null),h=(0,f4.useRef)(null),m=(0,f4.useRef)(null),[p,g]=(0,f4.useState)(!0);e:{if(u.playerName){t=u.playerName;break e}if("string"==typeof u.id){let e;if(l[0]!==u.id){let t;l[2]===Symbol.for("react.memo_cache_sentinel")?(t=/^player_/,l[2]=t):t=l[2],e=u.id.replace(t,"Player "),l[0]=u.id,l[1]=e}else e=l[1];t=e;break e}t=`Player ${u.id}`}let v=t;l[3]!==u.keyframes?(r=u.keyframes.some(hU),l[3]=u.keyframes,l[4]=r):r=l[4];let y=r;return l[5]!==d||l[6]!==u.iffColor||l[7]!==u.keyframes||l[8]!==y||l[9]!==p||l[10]!==c?(a=()=>{let e=f.current;if(!e)return;e.getWorldPosition(f6);let t=d.position.distanceTo(f6),r=t<150;if(p!==r&&g(r),r){if(h.current){let e=Math.max(0,Math.min(1,1-t/150));h.current.style.opacity=e.toString()}if(m.current&&y){let e=hC(u.keyframes,c.current),t=e?.health??1;m.current.style.width=`${Math.max(0,Math.min(100,100*t))}%`,m.current.style.background=u.iffColor?`rgb(${u.iffColor.r}, ${u.iffColor.g}, ${u.iffColor.b})`:""}}},l[5]=d,l[6]=u.iffColor,l[7]=u.keyframes,l[8]=y,l[9]=p,l[10]=c,l[11]=a):a=l[11],(0,A.useFrame)(a),l[12]!==v||l[13]!==y||l[14]!==p?(o=p&&(0,n.jsx)(f5.Html,{position:[0,2.8,0],center:!0,children:(0,n.jsxs)("div",{ref:h,className:"PlayerNameplate",children:[(0,n.jsx)("div",{className:"PlayerNameplate-name",children:v}),y&&(0,n.jsx)("div",{className:"PlayerNameplate-healthBar",children:(0,n.jsx)("div",{ref:m,className:"PlayerNameplate-healthFill"})})]})}),l[12]=v,l[13]=y,l[14]=p,l[15]=o):o=l[15],l[16]!==o?(s=(0,n.jsx)("group",{ref:f,children:o}),l[16]=o,l[17]=s):s=l[17],s}function hU(e){return null!=e.health}function hH(e){let t,r,a,o,s,l=(0,i.c)(14),{visual:c}=e;l[0]!==c.texture?(t=(0,y.textureToUrl)(c.texture),l[0]=c.texture,l[1]=t):t=l[1];let d=t,f=(0,B.useTexture)(d,hN),h=Array.isArray(f)?f[0]:f;l[2]!==c.color.b||l[3]!==c.color.g||l[4]!==c.color.r?(r=new u.Color().setRGB(c.color.r,c.color.g,c.color.b,u.SRGBColorSpace),l[2]=c.color.b,l[3]=c.color.g,l[4]=c.color.r,l[5]=r):r=l[5];let m=r;return l[6]!==c.size?(a=[c.size,c.size,1],l[6]=c.size,l[7]=a):a=l[7],l[8]!==m||l[9]!==h?(o=(0,n.jsx)("spriteMaterial",{map:h,color:m,transparent:!0,blending:u.AdditiveBlending,depthWrite:!1,toneMapped:!1}),l[8]=m,l[9]=h,l[10]=o):o=l[10],l[11]!==a||l[12]!==o?(s=(0,n.jsx)("sprite",{scale:a,children:o}),l[11]=a,l[12]=o,l[13]=s):s=l[13],s}function hN(e){hF(Array.isArray(e)?e[0]:e)}function hJ(e){let t,r,a,o,s,l,c,d,f,h,m,p,g=(0,i.c)(28),{entity:v,visual:F}=e,b=(0,f4.useRef)(null),C=(0,f4.useRef)(null),S=(0,f4.useRef)(null);g[0]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Quaternion,g[0]=t):t=g[0];let x=(0,f4.useRef)(t);g[1]!==F.texture?(r=(0,y.textureToUrl)(F.texture),g[1]=F.texture,g[2]=r):r=g[2];let E=F.crossTexture??F.texture;g[3]!==E?(a=(0,y.textureToUrl)(E),g[3]=E,g[4]=a):a=g[4],g[5]!==r||g[6]!==a?(o=[r,a],g[5]=r,g[6]=a,g[7]=o):o=g[7];let M=o,D=(0,B.useTexture)(M,hK);g[8]!==D?(s=Array.isArray(D)?D:[D,D],g[8]=D,g[9]=s):s=g[9];let[k,w]=s;return g[10]!==v||g[11]!==F.crossSize||g[12]!==F.crossViewAng||g[13]!==F.renderCross||g[14]!==F.tracerLength||g[15]!==F.tracerWidth?(l=e=>{var t;let{camera:r}=e,a=b.current,n=C.current;if(!a||!n)return;let i=v.keyframes[0],o=i?.position,s=v.direction??i?.velocity;if(!o||!s||(hb(s,hs),1e-8>hs.lengthSq())){a.visible=!1,S.current&&(S.current.visible=!1);return}hs.normalize(),a.visible=!0,hb(o,hf),hl.copy(hf).sub(r.position),hu.crossVectors(hl,hs),1e-8>hu.lengthSq()&&(hu.crossVectors(hg,hs),1e-8>hu.lengthSq()&&hu.set(1,0,0)),hu.normalize().multiplyScalar(F.tracerWidth);let l=.5*F.tracerLength;hc.copy(hs).multiplyScalar(-l),hd.copy(hs).multiplyScalar(l);let u=n.array;u[0]=hc.x+hu.x,u[1]=hc.y+hu.y,u[2]=hc.z+hu.z,u[3]=hc.x-hu.x,u[4]=hc.y-hu.y,u[5]=hc.z-hu.z,u[6]=hd.x-hu.x,u[7]=hd.y-hu.y,u[8]=hd.z-hu.z,u[9]=hd.x+hu.x,u[10]=hd.y+hu.y,u[11]=hd.z+hu.z,n.needsUpdate=!0;let c=S.current;if(!c)return;if(!F.renderCross){c.visible=!1;return}hl.normalize();let d=hs.dot(hl);if(d>-F.crossViewAng&&dhh.lengthSq()&&hh.set(-1,0,0),hh.normalize(),hm.crossVectors(hh,hs).normalize(),hp.set(hh.x,hs.x,hm.x,0,hh.y,hs.y,hm.y,0,hh.z,hs.z,hm.z,0,0,0,0,1),t.setFromRotationMatrix(hp),c.quaternion.copy(x.current),c.scale.setScalar(F.crossSize)},g[10]=v,g[11]=F.crossSize,g[12]=F.crossViewAng,g[13]=F.renderCross,g[14]=F.tracerLength,g[15]=F.tracerWidth,g[16]=l):l=g[16],(0,A.useFrame)(l),g[17]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)("bufferAttribute",{ref:C,attach:"attributes-position",args:[new Float32Array(12),3]}),g[17]=c):c=g[17],g[18]===Symbol.for("react.memo_cache_sentinel")?(d=(0,n.jsx)("bufferAttribute",{attach:"attributes-uv",args:[new Float32Array([0,0,0,1,1,1,1,0]),2]}),g[18]=d):d=g[18],g[19]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsxs)("bufferGeometry",{children:[c,d,(0,n.jsx)("bufferAttribute",{attach:"index",args:[new Uint16Array([0,1,2,0,2,3]),1]})]}),g[19]=f):f=g[19],g[20]!==k?(h=(0,n.jsxs)("mesh",{ref:b,children:[f,(0,n.jsx)("meshBasicMaterial",{map:k,transparent:!0,blending:u.AdditiveBlending,side:u.DoubleSide,depthWrite:!1,toneMapped:!1})]}),g[20]=k,g[21]=h):h=g[21],g[22]!==w||g[23]!==F.renderCross?(m=F.renderCross?(0,n.jsxs)("mesh",{ref:S,children:[(0,n.jsxs)("bufferGeometry",{children:[(0,n.jsx)("bufferAttribute",{attach:"attributes-position",args:[new Float32Array([-.5,0,-.5,.5,0,-.5,.5,0,.5,-.5,0,.5]),3]}),(0,n.jsx)("bufferAttribute",{attach:"attributes-uv",args:[new Float32Array([0,0,0,1,1,1,1,0]),2]}),(0,n.jsx)("bufferAttribute",{attach:"index",args:[new Uint16Array([0,1,2,0,2,3]),1]})]}),(0,n.jsx)("meshBasicMaterial",{map:w,transparent:!0,blending:u.AdditiveBlending,side:u.DoubleSide,depthWrite:!1,toneMapped:!1})]}):null,g[22]=w,g[23]=F.renderCross,g[24]=m):m=g[24],g[25]!==h||g[26]!==m?(p=(0,n.jsxs)(n.Fragment,{children:[h,m]}),g[25]=h,g[26]=m,g[27]=p):p=g[27],p}function hK(e){for(let t of Array.isArray(e)?e:[e])hF(t)}function hV(e){let t,r,a=(0,i.c)(9),{entity:o}=e,s=String(o.id);a[0]!==o.className||a[1]!==o.dataBlockId||a[2]!==o.ghostIndex||a[3]!==o.shapeHint||a[4]!==o.type||a[5]!==s?((t=[]).push(`${s} (${o.type})`),o.className&&t.push(`class ${o.className}`),"number"==typeof o.ghostIndex&&t.push(`ghost ${o.ghostIndex}`),"number"==typeof o.dataBlockId&&t.push(`db ${o.dataBlockId}`),t.push(o.shapeHint?`shapeHint ${o.shapeHint}`:"shapeHint "),a[0]=o.className,a[1]=o.dataBlockId,a[2]=o.ghostIndex,a[3]=o.shapeHint,a[4]=o.type,a[5]=s,a[6]=t):t=a[6];let l=t.join(" | ");return a[7]!==l?(r=(0,n.jsx)(e3.FloatingLabel,{color:"#ff6688",children:l}),a[7]=l,a[8]=r):r=a[8],r}function hz(e){let t,r,a,o,s,l,u,c,d=(0,i.c)(77),{entity:f,timeRef:h}=e,m=(0,E.useDebug)(),p=m?.debugMode??!1,g=String(f.id);if(f.visual?.kind==="tracer"){let e,t,r,a,i;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e={demoVisualKind:"tracer"},d[0]=e):e=d[0],d[1]!==f?(t=(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hJ,{entity:f,visual:f.visual})}),d[1]=f,d[2]=t):t=d[2],d[3]!==p||d[4]!==f?(r=p?(0,n.jsx)(hV,{entity:f}):null,d[3]=p,d[4]=f,d[5]=r):r=d[5],d[6]!==t||d[7]!==r?(a=(0,n.jsxs)("group",{name:"model",userData:e,children:[t,r]}),d[6]=t,d[7]=r,d[8]=a):a=d[8],d[9]!==g||d[10]!==a?(i=(0,n.jsx)("group",{name:g,children:a}),d[9]=g,d[10]=a,d[11]=i):i=d[11],i}if(f.visual?.kind==="sprite"){let e,t,r,a,i;return d[12]===Symbol.for("react.memo_cache_sentinel")?(e={demoVisualKind:"sprite"},d[12]=e):e=d[12],d[13]!==f.visual?(t=(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hH,{visual:f.visual})}),d[13]=f.visual,d[14]=t):t=d[14],d[15]!==p||d[16]!==f?(r=p?(0,n.jsx)(hV,{entity:f}):null,d[15]=p,d[16]=f,d[17]=r):r=d[17],d[18]!==t||d[19]!==r?(a=(0,n.jsxs)("group",{name:"model",userData:e,children:[t,r]}),d[18]=t,d[19]=r,d[20]=a):a=d[20],d[21]!==g||d[22]!==a?(i=(0,n.jsx)("group",{name:g,children:a}),d[21]=g,d[22]=a,d[23]=i):i=d[23],i}if(!f.dataBlock){let e,t,r,a,i,o;return d[24]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("sphereGeometry",{args:[.3,6,4]}),d[24]=e):e=d[24],d[25]!==f.type?(t=h$(f.type),d[25]=f.type,d[26]=t):t=d[26],d[27]!==t?(r=(0,n.jsxs)("mesh",{children:[e,(0,n.jsx)("meshBasicMaterial",{color:t,wireframe:!0})]}),d[27]=t,d[28]=r):r=d[28],d[29]!==p||d[30]!==f?(a=p?(0,n.jsx)(hV,{entity:f}):null,d[29]=p,d[30]=f,d[31]=a):a=d[31],d[32]!==r||d[33]!==a?(i=(0,n.jsxs)("group",{name:"model",children:[r,a]}),d[32]=r,d[33]=a,d[34]=i):i=d[34],d[35]!==g||d[36]!==i?(o=(0,n.jsx)("group",{name:g,children:i}),d[35]=g,d[36]=i,d[37]=o):o=d[37],o}d[38]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)("sphereGeometry",{args:[.5,8,6]}),d[38]=t):t=d[38],d[39]!==f.type?(r=h$(f.type),d[39]=f.type,d[40]=r):r=d[40],d[41]!==r?(a=(0,n.jsxs)("mesh",{children:[t,(0,n.jsx)("meshBasicMaterial",{color:r,wireframe:!0})]}),d[41]=r,d[42]=a):a=d[42];let v=a;if("Player"===f.type){let e,t,r,a,i,o;return d[43]!==f||d[44]!==h?(e=(0,n.jsx)(hq,{entity:f,timeRef:h}),d[43]=f,d[44]=h,d[45]=e):e=d[45],d[46]!==v||d[47]!==e?(t=(0,n.jsx)(f4.Suspense,{fallback:v,children:e}),d[46]=v,d[47]=e,d[48]=t):t=d[48],d[49]!==v||d[50]!==t?(r=(0,n.jsx)(hZ,{fallback:v,children:t}),d[49]=v,d[50]=t,d[51]=r):r=d[51],d[52]!==f||d[53]!==h?(a=(0,n.jsx)(hO,{entity:f,timeRef:h}),d[52]=f,d[53]=h,d[54]=a):a=d[54],d[55]!==r||d[56]!==a?(i=(0,n.jsxs)("group",{name:"model",children:[r,a]}),d[55]=r,d[56]=a,d[57]=i):i=d[57],d[58]!==g||d[59]!==i?(o=(0,n.jsx)("group",{name:g,children:i}),d[58]=g,d[59]=i,d[60]=o):o=d[60],o}return d[61]!==f.dataBlock||d[62]!==f.id?(o=(0,n.jsx)(hW,{shapeName:f.dataBlock,entityId:f.id}),d[61]=f.dataBlock,d[62]=f.id,d[63]=o):o=d[63],d[64]!==v||d[65]!==o?(s=(0,n.jsx)(f4.Suspense,{fallback:v,children:o}),d[64]=v,d[65]=o,d[66]=s):s=d[66],d[67]!==v||d[68]!==s?(l=(0,n.jsx)("group",{name:"model",children:(0,n.jsx)(hZ,{fallback:v,children:s})}),d[67]=v,d[68]=s,d[69]=l):l=d[69],d[70]!==f.dataBlock||d[71]!==f.weaponShape?(u=f.weaponShape&&(0,n.jsx)("group",{name:"weapon",children:(0,n.jsx)(hZ,{fallback:null,children:(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hX,{shapeName:f.weaponShape,playerShapeName:f.dataBlock})})})}),d[70]=f.dataBlock,d[71]=f.weaponShape,d[72]=u):u=d[72],d[73]!==g||d[74]!==l||d[75]!==u?(c=(0,n.jsxs)("group",{name:g,children:[l,u]}),d[73]=g,d[74]=l,d[75]=u,d[76]=c):c=d[76],c}function hq(e){let t,r,a,o,s,l,c,d,f,h,m,p,g,v=(0,i.c)(28),{entity:y,timeRef:F}=e,b=(0,R.useEngineStoreApi)(),C=t_(y.dataBlock);if(v[0]!==C.scene){var B;let e,n,i;B=C.scene,e=new Map,n=new Map,i=B.clone(),function e(t,r,a){a(t,r);for(let n=0;n{t||"Mount0"!==e.name||(t=e)}),v[0]=C.scene,v[1]=t,v[2]=r,v[3]=a}else t=v[1],r=v[2],a=v[3];v[4]!==t||v[5]!==r||v[6]!==a?(o={clonedScene:a,mixer:r,mount0:t},v[4]=t,v[5]=r,v[6]=a,v[7]=o):o=v[7];let{clonedScene:S,mixer:x,mount0:E}=o;v[8]===Symbol.for("react.memo_cache_sentinel")?(s=new Map,v[8]=s):s=v[8];let M=(0,f4.useRef)(s);v[9]===Symbol.for("react.memo_cache_sentinel")?(l={name:"Root",timeScale:1},v[9]=l):l=v[9];let D=(0,f4.useRef)(l);return v[10]!==C.animations||v[11]!==x?(c=()=>{let e=new Map;for(let t of C.animations){let r=x.clipAction(t);e.set(t.name.toLowerCase(),r)}M.current=e;let t=e.get("root");return t&&t.play(),D.current={name:"Root",timeScale:1},x.update(0),()=>{x.stopAllAction(),M.current=new Map}},d=[x,C.animations],v[10]=C.animations,v[11]=x,v[12]=c,v[13]=d):(c=v[12],d=v[13]),(0,f4.useEffect)(c,d),v[14]!==b||v[15]!==y.keyframes||v[16]!==x||v[17]!==F?(f=(e,t)=>{let r=b.getState().playback,a="playing"===r.status,n=F.current,i=hC(y.keyframes,n),o=function(e,t){if(!e)return{animation:"Root",timeScale:1};let[r,a,n]=e;if(n<-10)return{animation:"Fall",timeScale:1};let i=-2*Math.atan2(t[1],t[3]),o=Math.cos(i),s=Math.sin(i),l=r*o+a*s,u=-r*s+a*o,c=-u,d=-l,f=Math.max(u,c,d,l);return f<.1?{animation:"Root",timeScale:1}:f===u?{animation:"Forward",timeScale:1}:f===c?{animation:"Back",timeScale:1}:f===d?{animation:"Side",timeScale:1}:{animation:"Side",timeScale:-1}}(i?.velocity,i?.rotation??[0,0,0,1]),s=D.current;if(o.animation!==s.name||o.timeScale!==s.timeScale){let e=M.current,t=e.get(s.name.toLowerCase()),r=e.get(o.animation.toLowerCase());r&&(a&&t&&t!==r?(t.fadeOut(.25),r.reset().fadeIn(.25).play()):(t&&t!==r&&t.stop(),r.reset().play()),r.timeScale=o.timeScale,D.current={name:o.animation,timeScale:o.timeScale})}a?x.update(t*r.rate):x.update(0)},v[14]=b,v[15]=y.keyframes,v[16]=x,v[17]=F,v[18]=f):f=v[18],(0,A.useFrame)(f),v[19]===Symbol.for("react.memo_cache_sentinel")?(h=[0,Math.PI/2,0],v[19]=h):h=v[19],v[20]!==S?(m=(0,n.jsx)("group",{rotation:h,children:(0,n.jsx)("primitive",{object:S})}),v[20]=S,v[21]=m):m=v[21],v[22]!==y.weaponShape||v[23]!==E?(p=y.weaponShape&&E&&(0,n.jsx)(hZ,{fallback:null,children:(0,n.jsx)(f4.Suspense,{fallback:null,children:(0,n.jsx)(hQ,{weaponShape:y.weaponShape,mount0:E})})}),v[22]=y.weaponShape,v[23]=E,v[24]=p):p=v[24],v[25]!==m||v[26]!==p?(g=(0,n.jsxs)(n.Fragment,{children:[m,p]}),v[25]=m,v[26]=p,v[27]=g):g=v[27],g}function hQ(e){let t,r,a=(0,i.c)(7),{weaponShape:n,mount0:o}=e,s=t_(n);return a[0]!==o||a[1]!==s.animations||a[2]!==s.scene?(t=()=>{let e=s.scene.clone(!0);hE(e);let t=hB(s.scene,s.animations,"Mountpoint");if(t){let r=t.quaternion.clone().invert(),a=t.position.clone().negate().applyQuaternion(r);e.position.copy(a),e.quaternion.copy(r)}return o.add(e),()=>{o.remove(e)}},a[0]=o,a[1]=s.animations,a[2]=s.scene,a[3]=t):t=a[3],a[4]!==o||a[5]!==s?(r=[s,o],a[4]=o,a[5]=s,a[6]=r):r=a[6],(0,f4.useEffect)(t,r),null}function hW(e){let t,r,a,o=(0,i.c)(6),{shapeName:s,entityId:l}=e,u="number"==typeof l?l:0;o[0]!==u?(t={_class:"player",_className:"Player",_id:u},o[0]=u,o[1]=t):t=o[1];let c=t;return o[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,n.jsx)(tz,{loadingColor:"#00ff88"}),o[2]=r):r=o[2],o[3]!==s||o[4]!==c?(a=(0,n.jsx)(tk,{object:c,shapeName:s,type:"StaticShape",children:r}),o[3]=s,o[4]=c,o[5]=a):a=o[5],a}function hX(e){let t,r,a,o,s,l=(0,i.c)(16),{shapeName:u,playerShapeName:c}=e,d=t_(c),f=t_(u);if(l[0]!==d.animations||l[1]!==d.scene||l[2]!==f){e:{let e,r,a,n=hB(d.scene,d.animations,"Mount0");if(!n){let e;l[4]===Symbol.for("react.memo_cache_sentinel")?(e={position:void 0,quaternion:void 0},l[4]=e):e=l[4],t=e;break e}let i=hB(f.scene,f.animations,"Mountpoint");if(i){let t=i.quaternion.clone().invert(),a=i.position.clone().negate().applyQuaternion(t);r=n.quaternion.clone().multiply(t),e=a.clone().applyQuaternion(n.quaternion).add(n.position)}else e=n.position.clone(),r=n.quaternion.clone();let o=e.applyQuaternion(hv),s=hv.clone().multiply(r).multiply(hy);l[5]!==o||l[6]!==s?(a={position:o,quaternion:s},l[5]=o,l[6]=s,l[7]=a):a=l[7],t=a}l[0]=d.animations,l[1]=d.scene,l[2]=f,l[3]=t}else t=l[3];let h=t;l[8]===Symbol.for("react.memo_cache_sentinel")?(r={_class:"weapon",_className:"Weapon",_id:0},l[8]=r):r=l[8];let m=r;return l[9]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)(tz,{loadingColor:"#4488ff"}),l[9]=a):a=l[9],l[10]!==h.position||l[11]!==h.quaternion?(o=(0,n.jsx)("group",{position:h.position,quaternion:h.quaternion,children:a}),l[10]=h.position,l[11]=h.quaternion,l[12]=o):o=l[12],l[13]!==u||l[14]!==o?(s=(0,n.jsx)(tk,{object:m,shapeName:u,type:"Item",children:o}),l[13]=u,l[14]=o,l[15]=s):s=l[15],s}function hY(e){let t,r,a=(0,i.c)(7),{shapeName:n,eyeOffsetRef:o}=e,s=t_(n);return a[0]!==o||a[1]!==s.animations||a[2]!==s.scene?(t=()=>{let e=hB(s.scene,s.animations,"Eye");e?o.current.set(e.position.z,e.position.y,-e.position.x):o.current.set(0,2.1,0)},a[0]=o,a[1]=s.animations,a[2]=s.scene,a[3]=t):t=a[3],a[4]!==o||a[5]!==s?(r=[s,o],a[4]=o,a[5]=s,a[6]=r):r=a[6],(0,f4.useEffect)(t,r),null}class hZ extends f4.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.warn("[demo] Shape load failed:",e.message,t.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function h$(e){switch(e.toLowerCase()){case"player":return"#00ff88";case"vehicle":return"#ff8800";case"projectile":return"#ff0044";case"deployable":return"#ffcc00";default:return"#8888ff"}}var h0=e.i(30064);let h1=[.25,.5,1,2,4];function h2(e){let t=Math.floor(e/60),r=Math.floor(e%60);return`${t}:${r.toString().padStart(2,"0")}`}function h3(){let e,t,r,a,o,s,l,u,c,d,f,h,m,p,g,v,y,A,F,b,C=(0,i.c)(55),B=r$(),S=r1(),x=r3(),E=(0,R.useEngineSelector)(r5),M=(0,R.useEngineSelector)(r8),{play:D,pause:k,seek:w,setSpeed:I}=r4(),T=(0,R.useEngineStoreApi)(),P=(0,R.useEngineSelector)(mr),G=(0,R.useEngineSelector)(mt),L=(0,R.useEngineSelector)(me),j=(0,R.useEngineSelector)(h7),_=(0,R.useEngineSelector)(h6);C[0]!==w?(e=e=>{w(parseFloat(e.target.value))},C[0]=w,C[1]=e):e=C[1];let O=e;C[2]!==I?(t=e=>{I(parseFloat(e.target.value))},C[2]=I,C[3]=t):t=C[3];let U=t;C[4]!==T?(r=()=>{let e=T.getState(),t=(0,h0.buildSerializableDiagnosticsSnapshot)(e),r=(0,h0.buildSerializableDiagnosticsJson)(e);console.log("[demo diagnostics dump]",t),console.log("[demo diagnostics dump json]",r)},C[4]=T,C[5]=r):r=C[5];let H=r;C[6]!==T?(a=()=>{T.getState().clearPlaybackDiagnostics(),console.info("[demo diagnostics] Cleared playback diagnostics")},C[6]=T,C[7]=a):a=C[7];let N=a;if(!B)return null;let J=S?k:D,K=S?"Pause":"Play",V=S?"❚❚":"▶";C[8]!==J||C[9]!==K||C[10]!==V?(o=(0,n.jsx)("button",{className:"DemoControls-playPause",onClick:J,"aria-label":K,children:V}),C[8]=J,C[9]=K,C[10]=V,C[11]=o):o=C[11],C[12]!==x?(s=h2(x),C[12]=x,C[13]=s):s=C[13],C[14]!==E?(l=h2(E),C[14]=E,C[15]=l):l=C[15];let z=`${s} / ${l}`;C[16]!==z?(u=(0,n.jsx)("span",{className:"DemoControls-time",children:z}),C[16]=z,C[17]=u):u=C[17],C[18]!==x||C[19]!==E||C[20]!==O?(c=(0,n.jsx)("input",{className:"DemoControls-seek",type:"range",min:0,max:E,step:.01,value:x,onChange:O}),C[18]=x,C[19]=E,C[20]=O,C[21]=c):c=C[21],C[22]===Symbol.for("react.memo_cache_sentinel")?(d=h1.map(h9),C[22]=d):d=C[22],C[23]!==U||C[24]!==M?(f=(0,n.jsx)("select",{className:"DemoControls-speed",value:M,onChange:U,children:d}),C[23]=U,C[24]=M,C[25]=f):f=C[25];let q=P?"true":void 0,Q=P?"WebGL context: LOST":"WebGL context: ok";if(C[26]!==Q?(h=(0,n.jsx)("div",{className:"DemoDiagnosticsPanel-status",children:Q}),C[26]=Q,C[27]=h):h=C[27],C[28]!==L){var W;m=(0,n.jsx)("div",{className:"DemoDiagnosticsPanel-metrics",children:L?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{children:["geom ",L.geometries," tex"," ",L.textures," prog"," ",L.programs]}),(0,n.jsxs)("span",{children:["draw ",L.renderCalls," tri"," ",L.renderTriangles]}),(0,n.jsxs)("span",{children:["scene ",L.visibleSceneObjects,"/",L.sceneObjects]}),(0,n.jsxs)("span",{children:["heap ",Number.isFinite(W=L.jsHeapUsed)&&null!=W?W<1024?`${Math.round(W)} B`:W<1048576?`${(W/1024).toFixed(1)} KB`:W<0x40000000?`${(W/1048576).toFixed(1)} MB`:`${(W/0x40000000).toFixed(2)} GB`:"n/a"]})]}):(0,n.jsx)("span",{children:"No renderer samples yet"})}),C[28]=L,C[29]=m}else m=C[29];return C[30]!==j||C[31]!==G?(p=(0,n.jsxs)("span",{children:["samples ",G," events ",j]}),C[30]=j,C[31]=G,C[32]=p):p=C[32],C[33]!==_?(g=_?(0,n.jsxs)("span",{title:_.message,children:["last event: ",_.kind]}):(0,n.jsx)("span",{children:"last event: none"}),C[33]=_,C[34]=g):g=C[34],C[35]!==H?(v=(0,n.jsx)("button",{type:"button",onClick:H,children:"Dump"}),C[35]=H,C[36]=v):v=C[36],C[37]!==N?(y=(0,n.jsx)("button",{type:"button",onClick:N,children:"Clear"}),C[37]=N,C[38]=y):y=C[38],C[39]!==p||C[40]!==g||C[41]!==v||C[42]!==y?(A=(0,n.jsxs)("div",{className:"DemoDiagnosticsPanel-footer",children:[p,g,v,y]}),C[39]=p,C[40]=g,C[41]=v,C[42]=y,C[43]=A):A=C[43],C[44]!==q||C[45]!==h||C[46]!==m||C[47]!==A?(F=(0,n.jsxs)("div",{className:"DemoDiagnosticsPanel","data-context-lost":q,children:[h,m,A]}),C[44]=q,C[45]=h,C[46]=m,C[47]=A,C[48]=F):F=C[48],C[49]!==u||C[50]!==c||C[51]!==f||C[52]!==F||C[53]!==o?(b=(0,n.jsxs)("div",{className:"DemoControls",onKeyDown:h4,onPointerDown:h8,onClick:h5,children:[o,u,c,f,F]}),C[49]=u,C[50]=c,C[51]=f,C[52]=F,C[53]=o,C[54]=b):b=C[54],b}function h9(e){return(0,n.jsxs)("option",{value:e,children:[e,"x"]},e)}function h5(e){return e.stopPropagation()}function h8(e){return e.stopPropagation()}function h4(e){return e.stopPropagation()}function h6(e){let t=e.diagnostics.playbackEvents;return t.length>0?t[t.length-1]:null}function h7(e){return e.diagnostics.playbackEvents.length}function me(e){let t=e.diagnostics.rendererSamples;return t.length>0?t[t.length-1]:null}function mt(e){return e.diagnostics.rendererSamples.length}function mr(e){return e.diagnostics.webglContextLost}var ma=e.i(75840);function mn(e,t){if(0===e.length)return{health:1,energy:1};let r=0,a=e.length-1;if(t<=e[0].time)return{health:e[0].health??1,energy:e[0].energy??1};if(t>=e[a].time)return{health:e[a].health??1,energy:e[a].energy??1};for(;a-r>1;){let n=r+a>>1;e[n].time<=t?r=n:a=n}return{health:e[r].health??1,energy:e[r].energy??1}}function mi(e){let t,r=(0,i.c)(2),{value:a}=e,o=Math.max(0,Math.min(100,100*a)),s=`${o}%`;return r[0]!==s?(t=(0,n.jsx)("div",{className:ma.default.HealthBar,children:(0,n.jsx)("div",{className:ma.default.BarFill,style:{width:s}})}),r[0]=s,r[1]=t):t=r[1],t}function mo(e){let t,r=(0,i.c)(2),{value:a}=e,o=Math.max(0,Math.min(100,100*a)),s=`${o}%`;return r[0]!==s?(t=(0,n.jsx)("div",{className:ma.default.EnergyBar,children:(0,n.jsx)("div",{className:ma.default.BarFill,style:{width:s}})}),r[0]=s,r[1]=t):t=r[1],t}function ms(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.ChatWindow}),t[0]=e):e=t[0],e}function ml(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.WeaponSlots}),t[0]=e):e=t[0],e}function mu(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.ToolBelt}),t[0]=e):e=t[0],e}function mc(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.Reticle}),t[0]=e):e=t[0],e}function md(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.TeamStats}),t[0]=e):e=t[0],e}function mf(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("div",{className:ma.default.Compass}),t[0]=e):e=t[0],e}function mh(){let e,t,r,a,o,s,l,u,c,d,f,h,m=(0,i.c)(44),p=r$(),g=r3(),v=(0,R.useEngineSelector)(mm);if(m[0]!==p){e:{let t=new Map;if(!p){e=t;break e}for(let e of p.entities)t.set(e.id,e);e=t}m[0]=p,m[1]=e}else e=m[1];let y=e;if(!p)return null;if(p.isMetadataOnly||p.isPartial){let e,t,r,a,i,o,s,l,u,c=v?.status;return c?(m[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)(ms,{}),t=(0,n.jsx)(mf,{}),m[2]=e,m[3]=t):(e=m[2],t=m[3]),m[4]!==c.health?(r=(0,n.jsx)(mi,{value:c.health}),m[4]=c.health,m[5]=r):r=m[5],m[6]!==c.energy?(a=(0,n.jsx)(mo,{value:c.energy}),m[6]=c.energy,m[7]=a):a=m[7],m[8]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)(md,{}),o=(0,n.jsx)(mc,{}),s=(0,n.jsx)(mu,{}),l=(0,n.jsx)(ml,{}),m[8]=i,m[9]=o,m[10]=s,m[11]=l):(i=m[8],o=m[9],s=m[10],l=m[11]),m[12]!==r||m[13]!==a?(u=(0,n.jsxs)("div",{className:ma.default.PlayerHUD,children:[e,t,r,a,i,o,s,l]}),m[12]=r,m[13]=a,m[14]=u):u=m[14],u):null}m[15]!==g||m[16]!==p.cameraModes?(t=function(e,t){if(0===e.length||t=e[e.length-1].time)return e[e.length-1];let r=0,a=e.length-1;for(;a-r>1;){let n=r+a>>1;e[n].time<=t?r=n:a=n}return e[r]}(p.cameraModes,g),m[15]=g,m[16]=p.cameraModes,m[17]=t):t=m[17];let A=t;m[18]===Symbol.for("react.memo_cache_sentinel")?(r={health:1,energy:1},m[18]=r):r=m[18];let F=r;if(A?.mode==="first-person"){let e,t,r;if(m[19]!==g||m[20]!==y||m[21]!==p.controlPlayerGhostId){let r=p.controlPlayerGhostId?y.get(p.controlPlayerGhostId):void 0,a=y.get("recording_player");e=r?mn(r.keyframes,g):void 0,t=a?mn(a.keyframes,g):void 0,m[19]=g,m[20]=y,m[21]=p.controlPlayerGhostId,m[22]=e,m[23]=t}else e=m[22],t=m[23];let a=t,n=e?.health??1,i=a?.energy??e?.energy??1;m[24]!==n||m[25]!==i?(r={health:n,energy:i},m[24]=n,m[25]=i,m[26]=r):r=m[26],F=r}else if(A?.mode==="third-person"&&A.orbitTargetId)if(m[27]!==g||m[28]!==y||m[29]!==A.orbitTargetId){let e=y.get(A.orbitTargetId);e&&(F=mn(e.keyframes,g)),m[27]=g,m[28]=y,m[29]=A.orbitTargetId,m[30]=F}else F=m[30];return m[31]===Symbol.for("react.memo_cache_sentinel")?(a=(0,n.jsx)(ms,{}),o=(0,n.jsx)(mf,{}),m[31]=a,m[32]=o):(a=m[31],o=m[32]),m[33]!==F.health?(s=(0,n.jsx)(mi,{value:F.health}),m[33]=F.health,m[34]=s):s=m[34],m[35]!==F.energy?(l=(0,n.jsx)(mo,{value:F.energy}),m[35]=F.energy,m[36]=l):l=m[36],m[37]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)(md,{}),d=(0,n.jsx)(mc,{}),f=(0,n.jsx)(mu,{}),u=(0,n.jsx)(ml,{}),m[37]=u,m[38]=c,m[39]=d,m[40]=f):(u=m[37],c=m[38],d=m[39],f=m[40]),m[41]!==s||m[42]!==l?(h=(0,n.jsxs)("div",{className:ma.default.PlayerHUD,children:[a,o,s,l,c,d,f,u]}),m[41]=s,m[42]=l,m[43]=h):h=m[43],h}function mm(e){return e.playback.streamSnapshot}var mp=e.i(50361),mg=e.i(24540);function mv(e,t,r){try{return e(t)}catch(e){return(0,mg.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function my(e){function t(t){if(void 0===t)return null;let r="";if(Array.isArray(t)){if(void 0===t[0])return null;r=t[0]}return"string"==typeof t&&(r=t),mv(e.parse,r)}return{type:"single",eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:r=>t(r)??e}},withOptions(e){return{...this,...e}}}}my({parse:e=>e,serialize:String}),my({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),my({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),my({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(1&t.length?"0":"")+t}}),my({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let mA=my({parse:e=>"true"===e.toLowerCase(),serialize:String});function mF(e,t){return e.valueOf()===t.valueOf()}my({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:mF}),my({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:mF}),my({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:mF});let mb=(0,mp.r)(),mC={};function mB(e,t,r,a,n,i){let o=!1,s=Object.entries(e).reduce((e,[s,l])=>{var u;let c=t?.[s]??s,d=a[c],f="multi"===l.type?[]:null,h=void 0===d?("multi"===l.type?r?.getAll(c):r?.get(c))??f:d;return n&&i&&((u=n[c]??f)===h||null!==u&&null!==h&&"string"!=typeof u&&"string"!=typeof h&&u.length===h.length&&u.every((e,t)=>e===h[t]))?e[s]=i[s]??null:(o=!0,e[s]=((0,mp.i)(h)?null:mv(l.parse,h,c))??null,n&&(n[c]=h)),e},{});if(!o){let t=Object.keys(e),r=Object.keys(i??{});o=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:s,hasChanged:o}}function mS(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function mx(e,t={}){let{parse:r,type:a,serialize:n,eq:i,defaultValue:s,...l}=t,[{[e]:u},c]=function(e,t={}){let r=(0,o.useId)(),a=(0,mg.i)(),n=(0,mg.a)(),{history:i="replace",scroll:s=a?.scroll??!1,shallow:l=a?.shallow??!0,throttleMs:u=mp.s.timeMs,limitUrlUpdates:c=a?.limitUrlUpdates,clearOnDefault:d=a?.clearOnDefault??!0,startTransition:f,urlKeys:h=mC}=t,m=Object.keys(e).join(","),p=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,h[e]??e])),[m,JSON.stringify(h)]),g=(0,mg.r)(Object.values(p)),v=g.searchParams,y=(0,o.useRef)({}),A=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),F=mp.t.useQueuedQueries(Object.values(p)),[b,C]=(0,o.useState)(()=>mB(e,h,v??new URLSearchParams,F).state),B=(0,o.useRef)(b);if((0,mg.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,m,b,v),Object.keys(y.current).join("&")!==Object.values(p).join("&")){let{state:t,hasChanged:a}=mB(e,h,v,F,y.current,B.current);a&&((0,mg.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:v,queuedQueries:F,queryRef:y.current,stateRef:B.current}),B.current=t,C(t)),y.current=Object.fromEntries(Object.entries(p).map(([t,r])=>[r,e[t]?.type==="multi"?v?.getAll(r):v?.get(r)??null]))}(0,o.useEffect)(()=>{let{state:t,hasChanged:a}=mB(e,h,v,F,y.current,B.current);a&&((0,mg.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:v,queuedQueries:F,queryRef:y.current,stateRef:B.current}),B.current=t,C(t))},[Object.values(p).map(e=>`${e}=${v?.getAll(e)}`).join("&"),JSON.stringify(F)]),(0,o.useEffect)(()=>{let t=Object.keys(e).reduce((t,a)=>(t[a]=({state:t,query:n})=>{C(i=>{let{defaultValue:o}=e[a],s=p[a],l=t??o??null;return Object.is(i[a]??o??null,l)?((0,mg.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,m,s,t,o,B.current),i):(B.current={...B.current,[a]:l},y.current[s]=n,(0,mg.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,m,s,t,o,B.current),B.current)})},t),{});for(let a of Object.keys(e)){let e=p[a];(0,mg.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,m),mb.on(e,t[a])}return()=>{for(let a of Object.keys(e)){let e=p[a];(0,mg.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,m),mb.off(e,t[a])}}},[m,p]);let S=(0,o.useCallback)((t,a={})=>{let o,h=Object.fromEntries(Object.keys(e).map(e=>[e,null])),v="function"==typeof t?t(mS(B.current,A))??h:t??h;(0,mg.c)("[nuq+ %s `%s`] setState: %O",r,m,v);let y=0,F=!1,b=[];for(let[t,r]of Object.entries(v)){let h=e[t],m=p[t];if(!h||void 0===r)continue;(a.clearOnDefault??h.clearOnDefault??d)&&null!==r&&void 0!==h.defaultValue&&(h.eq??((e,t)=>e===t))(r,h.defaultValue)&&(r=null);let v=null===r?null:(h.serialize??String)(r);mb.emit(m,{state:r,query:v});let A={key:m,query:v,options:{history:a.history??h.history??i,shallow:a.shallow??h.shallow??l,scroll:a.scroll??h.scroll??s,startTransition:a.startTransition??h.startTransition??f}};if(a?.limitUrlUpdates?.method==="debounce"||c?.method==="debounce"||h.limitUrlUpdates?.method==="debounce"){!0===A.options.shallow&&console.warn((0,mg.s)(422));let e=a?.limitUrlUpdates?.timeMs??c?.timeMs??h.limitUrlUpdates?.timeMs??mp.s.timeMs,t=mp.t.push(A,e,g,n);yt(e),F?mp.n.flush(g,n):mp.n.getPendingPromise(g));return o??C},[m,i,l,s,u,c?.method,c?.timeMs,f,p,g.updateUrl,g.getSearchParamsSnapshot,g.rateLimitFactor,n,A]);return[(0,o.useMemo)(()=>mS(b,A),[b,A]),S]}({[e]:{parse:r??(e=>e),type:a,serialize:n,eq:i,defaultValue:s}},l);return[u,(0,o.useCallback)((t,r={})=>c(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,c])]}let mE=(0,o.lazy)(()=>e.A(59197).then(e=>({default:e.MapInfoDialog}))),mM=new rM,mD={toneMapping:u.NoToneMapping,outputColorSpace:u.SRGBColorSpace},mk=my({parse(e){let[t,r]=e.split("~"),a=r,n=(0,ri.getMissionInfo)(t).missionTypes;return r&&n.includes(r)||(a=n[0]),{missionName:t,missionType:a}},serialize:({missionName:e,missionType:t})=>1===(0,ri.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function mw(){let e,t,r,a,s,l,[c,d]=mx("mission",mk),f=(0,R.useEngineStoreApi)(),[h,m]=mx("fog",mA),g=(0,o.useCallback)(()=>{m(null)},[m]),v=(0,o.useRef)(c);v.current=c;let y=(0,o.useCallback)(e=>{let t=v.current,r=function(e=0){let t=Error().stack;if(!t)return null;let r=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return r.length>0?r.join(" <= "):null}(1);f.getState().recordPlaybackDiagnosticEvent({kind:"mission.change.requested",message:"changeMission invoked",meta:{previousMissionName:t.missionName,previousMissionType:t.missionType??null,nextMissionName:e.missionName,nextMissionType:e.missionType??null,stack:r??"unavailable"}}),console.info("[mission trace] changeMission",{previousMission:t,nextMission:e,stack:r}),window.location.hash="",g(),d(e)},[f,d,g]),A=(r=(0,i.c)(2),a=(0,o.useRef)(null),r[0]===Symbol.for("react.memo_cache_sentinel")?(e=e=>{let t=window.matchMedia("(pointer: coarse)");return t.addEventListener("change",e),a.current=t,()=>{t.removeEventListener("change",e)}},r[0]=e):e=r[0],s=e,r[1]===Symbol.for("react.memo_cache_sentinel")?(t=()=>a.current?.matches??null,r[1]=t):t=r[1],l=t,(0,o.useSyncExternalStore)(s,l,fZ)),{missionName:F,missionType:b}=c,[C,B]=(0,o.useState)(!1),[S,x]=(0,o.useState)(0),[M,D]=(0,o.useState)(!0),k=S<1;(0,o.useEffect)(()=>{if(k)D(!0);else{let e=setTimeout(()=>D(!1),500);return()=>clearTimeout(e)}},[k]),(0,o.useEffect)(()=>(window.setMissionName=e=>{let t=(0,ri.getMissionInfo)(e).missionTypes;y({missionName:e,missionType:t[0]})},window.getMissionList=ri.getMissionList,window.getMissionInfo=ri.getMissionInfo,()=>{delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}),[y]),(0,o.useEffect)(()=>{let e=e=>{if("KeyI"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||B(!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let w=(0,o.useCallback)((e,t=0)=>{x(t)},[]),I=(0,o.useRef)(null),T=(0,o.useRef)({angle:0,force:0}),P=(0,o.useRef)(null),G=(0,o.useRef)({angle:0,force:0}),L=(0,o.useRef)(null);return(0,n.jsx)(rD.QueryClientProvider,{client:mM,children:(0,n.jsx)("main",{children:(0,n.jsx)(rZ,{children:(0,n.jsx)(E.SettingsProvider,{fogEnabledOverride:h,onClearFogEnabledOverride:g,children:(0,n.jsxs)(rR,{map:rQ,children:[(0,n.jsxs)("div",{id:"canvasContainer",children:[M&&(0,n.jsxs)("div",{id:"loadingIndicator","data-complete":!k,children:[(0,n.jsx)("div",{className:"LoadingSpinner"}),(0,n.jsx)("div",{className:"LoadingProgress",children:(0,n.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*S}%`}})}),(0,n.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*S),"%"]})]}),(0,n.jsx)(p,{frameloop:"always",gl:mD,shadows:{type:u.PCFShadowMap},onCreated:e=>{I.current=e.camera},children:(0,n.jsx)(t2,{children:(0,n.jsxs)(f1.AudioProvider,{children:[(0,n.jsx)(rd,{name:F,missionType:b,onLoadingChange:w},`${F}~${b}`),(0,n.jsx)(f0,{}),(0,n.jsx)(f8,{}),(0,n.jsx)(hD,{}),(0,n.jsx)(mR,{isTouch:A,joystickStateRef:T,joystickZoneRef:P,lookJoystickStateRef:G,lookJoystickZoneRef:L})]})})})]}),(0,n.jsx)(mh,{}),A&&(0,n.jsx)(am,{joystickState:T,joystickZone:P,lookJoystickState:G,lookJoystickZone:L}),!1===A&&(0,n.jsx)(ar,{}),(0,n.jsx)(fq,{missionName:F,missionType:b,onChangeMission:y,onOpenMapInfo:()=>B(!0),cameraRef:I,isTouch:A}),C&&(0,n.jsx)(o.Suspense,{fallback:null,children:(0,n.jsx)(mE,{open:C,onClose:()=>B(!1),missionName:F,missionType:b??""})}),(0,n.jsx)(mT,{changeMission:y,currentMission:c}),(0,n.jsx)(h3,{}),(0,n.jsx)(mP,{})]})})})})})}let mI={"Capture the Flag":"CTF","Capture and Hold":"CnH",Deathmatch:"DM","Team Deathmatch":"TDM",Siege:"Siege",Bounty:"Bounty",Rabbit:"Rabbit"};function mT(e){let t,r,a=(0,i.c)(5),{changeMission:n,currentMission:s}=e,l=r$();return a[0]!==n||a[1]!==s||a[2]!==l?(t=()=>{if(!l?.missionName)return;let e=(0,ri.findMissionByDemoName)(l.missionName);if(!e)return void console.warn(`Demo mission "${l.missionName}" not found in manifest`);let t=(0,ri.getMissionInfo)(e),r=l.gameType?mI[l.gameType]:void 0,a=r&&t.missionTypes.includes(r)?r:t.missionTypes[0];(s.missionName!==e||s.missionType!==a)&&n({missionName:e,missionType:a})},r=[l,n,s],a[0]=n,a[1]=s,a[2]=l,a[3]=t,a[4]=r):(t=a[3],r=a[4]),(0,o.useEffect)(t,r),null}function mR(e){let t,r=(0,i.c)(6),{isTouch:a,joystickStateRef:o,joystickZoneRef:s,lookJoystickStateRef:l,lookJoystickZoneRef:u}=e;if(r1()||null===a)return null;if(a){let e;return r[0]!==o||r[1]!==s||r[2]!==l||r[3]!==u?(e=(0,n.jsx)(ap,{joystickState:o,joystickZone:s,lookJoystickState:l,lookJoystickZone:u}),r[0]=o,r[1]=s,r[2]=l,r[3]=u,r[4]=e):e=r[4],e}return r[5]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)(rW,{}),r[5]=t):t=r[5],t}function mP(){let e,t,r=(0,i.c)(4),{setRecording:a}=r4(),n=(0,R.useEngineStoreApi)();return r[0]!==n||r[1]!==a?(e=()=>(window.loadDemoRecording=a,window.getDemoDiagnostics=()=>(0,h0.buildSerializableDiagnosticsSnapshot)(n.getState()),window.getDemoDiagnosticsJson=()=>(0,h0.buildSerializableDiagnosticsJson)(n.getState()),window.clearDemoDiagnostics=()=>{n.getState().clearPlaybackDiagnostics()},mG),t=[n,a],r[0]=n,r[1]=a,r[2]=e,r[3]=t):(e=r[2],t=r[3]),(0,o.useEffect)(e,t),null}function mG(){delete window.loadDemoRecording,delete window.getDemoDiagnostics,delete window.getDemoDiagnosticsJson,delete window.clearDemoDiagnostics}function mL(){let e,t=(0,i.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)(o.Suspense,{children:(0,n.jsx)(mw,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>mL],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/15f5b04504a3a132.js b/docs/_next/static/chunks/15f5b04504a3a132.js deleted file mode 100644 index d8dbe501..00000000 --- a/docs/_next/static/chunks/15f5b04504a3a132.js +++ /dev/null @@ -1,211 +0,0 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47071,971,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(73949),o=e.i(91037);e.s(["useLoader",()=>o.G],971);var o=o;let a=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function n(e,n){let l=(0,i.useThree)(e=>e.gl),s=(0,o.G)(r.TextureLoader,a(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==n||n(s)},[n]),(0,t.useEffect)(()=>{if("initTexture"in l){let e=[];Array.isArray(s)?e=s:s instanceof r.Texture?e=[s]:a(s)&&(e=Object.values(s)),e.forEach(e=>{e instanceof r.Texture&&l.initTexture(e)})}},[l,s]),(0,t.useMemo)(()=>{if(!a(e))return s;{let t={},r=0;for(let i in e)t[i]=s[r++];return t}},[e,s])}n.preload=e=>o.G.preload(r.TextureLoader,e),n.clear=e=>o.G.clear(r.TextureLoader,e),e.s(["useTexture",()=>n],47071)},6112,51475,77482,e=>{"use strict";var t=e.i(932),r=e.i(43476),i=e.i(71645),o=e.i(49774);let a=(0,i.createContext)(null);function n({children:e}){let t=(0,i.useRef)(void 0),n=(0,i.useRef)(0),l=(0,i.useRef)(0);(0,o.useFrame)((e,r)=>{for(n.current+=r;n.current>=.03125;)if(n.current-=.03125,l.current++,t.current)for(let e of t.current)e(l.current)});let s=(0,i.useCallback)(e=>(t.current??=new Set,t.current.add(e),()=>{t.current.delete(e)}),[]),c=(0,i.useCallback)(()=>l.current,[]),u=(0,i.useMemo)(()=>({subscribe:s,getTick:c}),[s,c]);return(0,r.jsx)(a.Provider,{value:u,children:e})}function l(e){let t=(0,i.useContext)(a);if(!t)throw Error("useTick must be used within a TickProvider");let r=(0,i.useRef)(e);r.current=e,(0,i.useEffect)(()=>t.subscribe(e=>r.current(e)),[t])}e.s(["TickProvider",()=>n,"useTick",()=>l],51475);let s=(0,i.createContext)(null);function c(e){let i,o,a=(0,t.c)(5),{runtime:l,children:c}=e;return a[0]!==c?(i=(0,r.jsx)(n,{children:c}),a[0]=c,a[1]=i):i=a[1],a[2]!==l||a[3]!==i?(o=(0,r.jsx)(s.Provider,{value:l,children:i}),a[2]=l,a[3]=i,a[4]=o):o=a[4],o}function u(){let e=(0,i.useContext)(s);if(!e)throw Error("useRuntime must be used within a RuntimeProvider");return e}function f(e){let r,i=(0,t.c)(3),o=u();if(e)return i[0]!==e||i[1]!==o.state.datablocks?(r=o.state.datablocks.get(e),i[0]=e,i[1]=o.state.datablocks,i[2]=r):r=i[2],r}e.s(["RuntimeProvider",()=>c,"useRuntime",()=>u],77482),e.s(["useDatablock",()=>f],6112)},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},75567,e=>{"use strict";var t=e.i(90072);function r(e,i={}){let{repeat:o=[1,1],disableMipmaps:a=!1}=i;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...o),e.flipY=!1,e.anisotropy=16,a?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function i(e){let r=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return r.colorSpace=t.NoColorSpace,r.wrapS=r.wrapT=t.RepeatWrapping,r.generateMipmaps=!1,r.minFilter=t.LinearFilter,r.magFilter=t.LinearFilter,r.needsUpdate=!0,r}e.s(["setupMask",()=>i,"setupTexture",()=>r])},47021,e=>{"use strict";var t=e.i(8560);let r=` -#ifdef USE_FOG - // Check fog enabled uniform - allows toggling without shader recompilation - #ifdef USE_VOLUMETRIC_FOG - if (!fogEnabled) { - // Skip all fog calculations when disabled - } else { - #endif - - float dist = vFogDepth; - - // Discard fragments at or beyond visible distance - matches Torque's behavior - // where objects beyond visibleDistance are not rendered at all. - // This prevents fully-fogged geometry from showing as silhouettes against - // the sky's fog-to-sky gradient. - if (dist >= fogFar) { - discard; - } - - // Step 1: Calculate distance-based haze (quadratic falloff) - // Since we discard at fogFar, haze never reaches 1.0 here - float haze = 0.0; - if (dist > fogNear) { - float fogScale = 1.0 / (fogFar - fogNear); - float distFactor = (dist - fogNear) * fogScale - 1.0; - haze = 1.0 - distFactor * distFactor; - } - - // Step 2: Calculate fog volume contributions - // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) - // All fog uses the global fogColor - see Tribes2_Fog_System.md for details - float volumeFog = 0.0; - - #ifdef USE_VOLUMETRIC_FOG - { - #ifdef USE_FOG_WORLD_POSITION - float fragmentHeight = vFogWorldPosition.y; - #else - float fragmentHeight = cameraHeight; - #endif - - float deltaY = fragmentHeight - cameraHeight; - float absDeltaY = abs(deltaY); - - // Determine if we're going up (positive) or down (negative) - if (absDeltaY > 0.01) { - // Non-horizontal ray: ray-march through fog volumes - 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]; - - // Skip inactive volumes (visibleDistance = 0) - if (volVisDist <= 0.0) continue; - - // Calculate fog factor for this volume - // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage - // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) - // Since we don't have quality settings, we use visFactor = 1.0 - float factor = (1.0 / volVisDist) * volPct; - - // Find ray intersection with this volume's height range - float rayMinY = min(cameraHeight, fragmentHeight); - float rayMaxY = max(cameraHeight, fragmentHeight); - - // Check if ray intersects volume height range - if (rayMinY < volMaxH && rayMaxY > volMinH) { - float intersectMin = max(rayMinY, volMinH); - float intersectMax = min(rayMaxY, volMaxH); - float intersectHeight = intersectMax - intersectMin; - - // Calculate distance traveled through this volume using similar triangles: - // subDist / dist = intersectHeight / absDeltaY - float subDist = dist * (intersectHeight / absDeltaY); - - // Accumulate fog: fog += subDist * factor - volumeFog += subDist * factor; - } - } - } else { - // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume - 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 camera is inside this volume, apply fog for full distance - if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { - float factor = (1.0 / volVisDist) * volPct; - volumeFog += dist * factor; - } - } - } - } - #endif - - // Step 3: Combine haze and volume fog - // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct - // This gives fog volumes priority over haze - float volPct = min(volumeFog, 1.0); - float hazePct = haze; - if (volPct + hazePct > 1.0) { - hazePct = 1.0 - volPct; - } - float fogFactor = hazePct + volPct; - - // Apply fog using global fogColor (per-volume colors not used in Tribes 2) - gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); - - #ifdef USE_VOLUMETRIC_FOG - } // end fogEnabled check - #endif -#endif -`;function i(){t.ShaderChunk.fog_pars_fragment=` -#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif - - // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) - // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats - #ifdef USE_VOLUMETRIC_FOG - uniform float fogVolumeData[12]; - uniform float cameraHeight; - #endif - - #ifdef USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; - #endif -#endif -`,t.ShaderChunk.fog_fragment=r,t.ShaderChunk.fog_pars_vertex=` -#ifdef USE_FOG - varying float vFogDepth; - #ifdef USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; - #endif -#endif -`,t.ShaderChunk.fog_vertex=` -#ifdef USE_FOG - // Use Euclidean distance from camera, not view-space z-depth - // This ensures fog doesn't change when rotating the camera - vFogDepth = length(mvPosition.xyz); - #ifdef USE_FOG_WORLD_POSITION - vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; - #endif -#endif -`}function o(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.uniforms.fogEnabled=t.fogEnabled,e.vertexShader=e.vertexShader.replace("#include ",`#include -#ifdef USE_FOG - #define USE_FOG_WORLD_POSITION - #define USE_VOLUMETRIC_FOG - varying vec3 vFogWorldPosition; -#endif`),e.vertexShader=e.vertexShader.replace("#include ",`#include -#ifdef USE_FOG - vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; -#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include -#ifdef USE_FOG - #define USE_VOLUMETRIC_FOG - uniform float fogVolumeData[12]; - uniform float cameraHeight; - uniform bool fogEnabled; - #define USE_FOG_WORLD_POSITION - varying vec3 vFogWorldPosition; -#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",r)}e.s(["fogFragmentShader",0,r,"injectCustomFog",()=>o,"installCustomFogShader",()=>i])},48066,e=>{"use strict";let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0},fogEnabled:{value:!0}};function r(e,i,o=!0){t.cameraHeight.value=e,t.fogVolumeData.value.set(i),t.fogEnabled.value=o}function i(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0),t.fogEnabled.value=!0}function o(e){let t=new Float32Array(12);for(let r=0;r<3;r++){let i=4*r,o=e[r];o&&(t[i+0]=o.visibleDistance,t[i+1]=o.minHeight,t[i+2]=o.maxHeight,t[i+3]=o.percentage)}return t}e.s(["globalFogUniforms",0,t,"packFogVolumeData",()=>o,"resetGlobalFogUniforms",()=>i,"updateGlobalFogUniforms",()=>r])},89887,60099,e=>{"use strict";let t,r;var i=e.i(43476),o=e.i(932),a=e.i(71645),n=e.i(49774),l=e.i(73949),s=e.i(90072),c=e.i(31067),u=e.i(88014);let f=new s.Vector3,d=new s.Vector3,m=new s.Vector3,g=new s.Vector2;function h(e,t,r){let i=f.setFromMatrixPosition(e.matrixWorld);i.project(t);let o=r.width/2,a=r.height/2;return[i.x*o+o,-(i.y*a)+a]}let v=e=>1e-10>Math.abs(e)?0:e;function p(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=v(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let x=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>p(e,t)),y=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>p(e,r(t),"translate(-50%,-50%)")),b=a.forwardRef(({children:e,eps:t=.001,style:r,className:i,prepend:o,center:p,fullscreen:b,portal:F,distanceFactor:S,sprite:M=!1,transform:P=!1,occlude:E,onOcclude:_,castShadow:T,receiveShadow:w,material:O,geometry:D,zIndexRange:C=[0x1000037,0],calculatePosition:R=h,as:H="div",wrapperClass:V,pointerEvents:W="auto",...L},U)=>{let{gl:k,camera:z,scene:G,size:I,raycaster:j,events:A,viewport:N}=(0,l.useThree)(),[$]=a.useState(()=>document.createElement(H)),Y=a.useRef(null),q=a.useRef(null),B=a.useRef(0),K=a.useRef([0,0]),X=a.useRef(null),Z=a.useRef(null),J=(null==F?void 0:F.current)||A.connected||k.domElement.parentNode,Q=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return E&&"blending"!==E||Array.isArray(E)&&E.length&&(e=E[0])&&"object"==typeof e&&"current"in e},[E]);a.useLayoutEffect(()=>{let e=k.domElement;E&&"blending"===E?(e.style.zIndex=`${Math.floor(C[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[E]),a.useLayoutEffect(()=>{if(q.current){let e=Y.current=u.createRoot($);if(G.updateMatrixWorld(),P)$.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=R(q.current,z,I);$.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return J&&(o?J.prepend($):J.appendChild($)),()=>{J&&J.removeChild($),e.unmount()}}},[J,P]),a.useLayoutEffect(()=>{V&&($.className=V)},[V]);let er=a.useMemo(()=>P?{position:"absolute",top:0,left:0,width:I.width,height:I.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:p?"translate3d(-50%,-50%,0)":"none",...b&&{top:-I.height/2,left:-I.width/2,width:I.width,height:I.height},...r},[r,p,b,I,P]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:W}),[W]);a.useLayoutEffect(()=>{var t,o;ee.current=!1,P?null==(t=Y.current)||t.render(a.createElement("div",{ref:X,style:er},a.createElement("div",{ref:Z,style:ei},a.createElement("div",{ref:U,className:i,style:r,children:e})))):null==(o=Y.current)||o.render(a.createElement("div",{ref:U,style:er,className:i,children:e}))});let eo=a.useRef(!0);(0,n.useFrame)(e=>{if(q.current){z.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=P?K.current:R(q.current,z,I);if(P||Math.abs(B.current-z.zoom)>t||Math.abs(K.current[0]-e[0])>t||Math.abs(K.current[1]-e[1])>t){var r;let t,i,o,a,n=(r=q.current,t=f.setFromMatrixPosition(r.matrixWorld),i=d.setFromMatrixPosition(z.matrixWorld),o=t.sub(i),a=z.getWorldDirection(m),o.angleTo(a)>Math.PI/2),l=!1;et&&(Array.isArray(E)?l=E.map(e=>e.current):"blending"!==E&&(l=[G]));let c=eo.current;l?eo.current=function(e,t,r,i){let o=f.setFromMatrixPosition(e.matrixWorld),a=o.clone();a.project(t),g.set(a.x,a.y),r.setFromCamera(g,t);let n=r.intersectObjects(i,!0);if(n.length){let e=n[0].distance;return o.distanceTo(r.ray.origin)({vertexShader:P?void 0:` - /* - This shader is from the THREE's SpriteMaterial. - We need to turn the backing plane into a Sprite - (make it always face the camera) if "transfrom" - is false. - */ - #include - - void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - // This is somewhat arbitrary, but it seems to work well - // Need to figure out how to derive this dynamically if it even matters - float size = 0.03; - - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - - gl_Position = projectionMatrix * mvPosition; - } - `,fragmentShader:` - void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } - `}),[P]);return a.createElement("group",(0,c.default)({},L,{ref:q}),E&&!et&&a.createElement("mesh",{castShadow:T,receiveShadow:w,ref:Q},D||a.createElement("planeGeometry",null),O||a.createElement("shaderMaterial",{side:s.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",()=>b],60099);let F=[0,0,0],S=(0,a.memo)(function(e){let t,r,c,u,f,d=(0,o.c)(19),{children:m,color:g,position:h,opacity:v}=e,p=void 0===g?"white":g,x=void 0===h?F:h,y=void 0===v?"fadeWithDistance":v,S="fadeWithDistance"===y,M=(0,a.useRef)(null),P=function(e){let t,r,i=(0,o.c)(3),{camera:c}=(0,l.useThree)(),u=(0,a.useRef)(null),f=(r=(0,a.useRef)(null),(0,n.useFrame)(()=>{e.current&&(r.current??=new s.Vector3,e.current.getWorldPosition(r.current))}),r);return i[0]!==c||i[1]!==f?(t=()=>{f.current?u.current=c.position.distanceTo(f.current):u.current=null},i[0]=c,i[1]=f,i[2]=t):t=i[2],(0,n.useFrame)(t),u}(M),[E,_]=(0,a.useState)(0!==y),T=(0,a.useRef)(null);return d[0]!==P||d[1]!==S?(t=()=>{if(S&&T.current&&null!=P.current){let e=Math.max(0,Math.min(1,1-P.current/200));T.current.style.opacity=e.toString()}},d[0]=P,d[1]=S,d[2]=t):t=d[2],d[3]!==P||d[4]!==S||d[5]!==E?(r=[E,S,P],d[3]=P,d[4]=S,d[5]=E,d[6]=r):r=d[6],(0,a.useEffect)(t,r),d[7]!==P||d[8]!==S||d[9]!==E||d[10]!==y?(c=()=>{if(S){let e=P.current,t=null!=e&&e<200;if(E!==t&&_(t),T.current&&t){let t=Math.max(0,Math.min(1,1-e/200));T.current.style.opacity=t.toString()}}else _(0!==y),T.current&&(T.current.style.opacity=y.toString())},d[7]=P,d[8]=S,d[9]=E,d[10]=y,d[11]=c):c=d[11],(0,n.useFrame)(c),d[12]!==m||d[13]!==p||d[14]!==E||d[15]!==x?(u=E?(0,i.jsx)(b,{position:x,center:!0,children:(0,i.jsx)("div",{ref:T,className:"StaticShapeLabel",style:{color:p},children:m})}):null,d[12]=m,d[13]=p,d[14]=E,d[15]=x,d[16]=u):u=d[16],d[17]!==u?(f=(0,i.jsx)("group",{ref:M,children:u}),d[17]=u,d[18]=f):f=d[18],f});e.s(["FloatingLabel",0,S],89887)},51434,e=>{"use strict";var t=e.i(43476),r=e.i(932),i=e.i(71645),o=e.i(73949),a=e.i(90072);let n=(0,i.createContext)(void 0);function l(e){let l,c,u,f,d=(0,r.c)(7),{children:m}=e,{camera:g}=(0,o.useThree)();d[0]===Symbol.for("react.memo_cache_sentinel")?(l={audioLoader:null,audioListener:null},d[0]=l):l=d[0];let[h,v]=(0,i.useState)(l);return d[1]!==g?(c=()=>{let e=new a.AudioLoader,t=g.children.find(s);t||(t=new a.AudioListener,g.add(t)),v({audioLoader:e,audioListener:t})},u=[g],d[1]=g,d[2]=c,d[3]=u):(c=d[2],u=d[3]),(0,i.useEffect)(c,u),d[4]!==h||d[5]!==m?(f=(0,t.jsx)(n.Provider,{value:h,children:m}),d[4]=h,d[5]=m,d[6]=f):f=d[6],f}function s(e){return e instanceof a.AudioListener}function c(){let e=(0,i.useContext)(n);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>l,"useAudio",()=>c])},61921,e=>{e.v(t=>Promise.all(["static/chunks/cb4089eec9313f48.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/4e5626f3eeee0985.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/6e74e9455d83b68c.js"].map(t=>e.l(t))).then(()=>t(42585)))},84968,e=>{e.v(t=>Promise.all(["static/chunks/70bf3e06d5674fac.js"].map(t=>e.l(t))).then(()=>t(90208)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/0be79f7f5e0597a7.css","static/chunks/1cf33c843f96e1c9.js"].map(t=>e.l(t))).then(()=>t(94247)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/5619c5b2b1355f74.js b/docs/_next/static/chunks/22ebafda1e5f0224.js similarity index 61% rename from docs/_next/static/chunks/5619c5b2b1355f74.js rename to docs/_next/static/chunks/22ebafda1e5f0224.js index 93362f87..98bd14e7 100644 --- a/docs/_next/static/chunks/5619c5b2b1355f74.js +++ b/docs/_next/static/chunks/22ebafda1e5f0224.js @@ -1,4 +1,4 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24478,(e,n,t)=>{"use strict";t.ConcurrentRoot=1,t.ContinuousEventPriority=8,t.DefaultEventPriority=32,t.DiscreteEventPriority=2,t.IdleEventPriority=0x10000000,t.LegacyRoot=0,t.NoEventPriority=0},39695,(e,n,t)=>{"use strict";n.exports=e.r(24478)},55838,(e,n,t)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!a(e,t)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),r=i({inst:{value:t,getSnapshot:n}}),a=r[0].inst,c=r[1];return l(function(){a.value=t,a.getSnapshot=n,u(a)&&c({inst:a})},[e,t,n]),o(function(){return u(a)&&c({inst:a}),e(function(){u(a)&&c({inst:a})})},[e]),s(t),t};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,n,t)=>{"use strict";n.exports=e.r(55838)},52822,(e,n,t)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,n,t,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var n=f.value;if(a(n,e))return l=n}return l=e}if(n=l,i(o,e))return n;var t=r(e);return void 0!==a&&a(n,t)?(o=e,n):(o=e,l=t)}var o,l,s=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]},[n,t,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,n,t)=>{"use strict";n.exports=e.r(52822)},29779,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},28563,(e,n,t)=>{"use strict";n.exports=e.r(29779)},40336,(e,n,t)=>{"use strict";var r=e.i(47167);n.exports=function(n){function t(e,n,t,r){return new rw(e,n,t,r)}function a(){}function i(e){var n="https://react.dev/errors/"+e;if(1)":-1a||u[r]!==c[a]){var d="\n"+u[r].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=r&&0<=a)break}}}finally{ao=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?s(t):""}function c(e){try{var n="";do n+=function(e){switch(e.tag){case 26:case 27:case 5:return s(e.type);case 16:return s("Lazy");case 13:return s("Suspense");case 19:return s("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function d(e){var n=e,t=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do 0!=(4098&(n=e).flags)&&(t=n.return),e=n.return;while(e)}return 3===n.tag?t:null}function f(e){if(d(e)!==e)throw Error(i(188))}function p(e){var n=e.alternate;if(!n){if(null===(n=d(e)))throw Error(i(188));return n!==e?null:e}for(var t=e,r=n;;){var a=t.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){t=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===t)return f(a),e;if(o===r)return f(a),n;o=o.sibling}throw Error(i(188))}if(t.return!==r.return)t=a,r=o;else{for(var l=!1,s=a.child;s;){if(s===t){l=!0,t=a,r=o;break}if(s===r){l=!0,r=a,t=o;break}s=s.sibling}if(!l){for(s=o.child;s;){if(s===t){l=!0,t=o,r=a;break}if(s===r){l=!0,r=o,t=a;break}s=s.sibling}if(!l)throw Error(i(189))}}if(t.alternate!==r)throw Error(i(190))}if(3!==t.tag)throw Error(i(188));return t.stateNode.current===t?e:n}function m(e){return{current:e}}function h(e){0>i4||(e.current=i2[i4],i2[i4]=null,i4--)}function g(e,n){i2[++i4]=e.current,e.current=n}function _(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function v(e,n){var t=e.pendingLanes;if(0===t)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,o=e.warmLanes;e=0!==e.finishedLanes;var l=0x7ffffff&t;return 0!==l?0!=(t=l&~a)?r=_(t):0!=(i&=l)?r=_(i):e||0!=(o=l&~o)&&(r=_(o)):0!=(l=t&~a)?r=_(l):0!==i?r=_(i):e||0!=(o=t&~o)&&(r=_(o)),0===r?0:0!==n&&n!==r&&0==(n&a)&&((a=r&-r)>=(o=n&-n)||32===a&&0!=(4194176&o))?n:r}function S(e,n){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function E(){var e=i7;return 0==(4194176&(i7<<=1))&&(i7=128),e}function T(){var e=oe;return 0==(0x3c00000&(oe<<=1))&&(oe=4194304),e}function b(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function M(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function x(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-i6(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&t}function R(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-i6(t),a=1<>=o,a-=o,oT=1<<32-i6(n)+a|t<f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],l);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&n(t,d),i=s(_,i,f),null===c?u=_:c.sibling=_,c=_,d=p}if(f===o.length)return r(t,d),oP&&A(t,f),u;if(null===d){for(;fp?(_=f,f=null):_=f.sibling;var S=h(t,f,v.value,u);if(null===S){null===f&&(f=_);break}e&&f&&null===S.alternate&&n(t,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=_}if(v.done)return r(t,f),oP&&A(t,p),c;if(null===f){for(;!v.done;p++,v=l.next())null!==(v=m(t,v.value,u))&&(o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return oP&&A(t,p),c}for(f=a(f);!v.done;p++,v=l.next())null!==(v=g(f,t,p,v.value,u))&&(e&&null!==v.alternate&&f.delete(null===v.key?p:v.key),o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return n(t,e)}),oP&&A(t,p),c}(c,d,f=_.call(f),p)}if("function"==typeof f.then)return t(c,d,e_(f),p);if(f.$$typeof===r2)return t(c,d,ts(c,f),p);eS(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(r(c,d.sibling),(p=l(d,f)).return=c):(r(c,d),(p=rO(f,c.mode,p)).return=c),u(c=p)):r(c,d)}(c,d,f,p);return oJ=null,_}catch(e){if(e===oK)throw e;var v=t(29,e,null,c.mode);return v.lanes=p,v.return=c,v}finally{}}}function eb(e,n){g(o4,e=l1),g(o2,n),l1=e|n.baseLanes}function eM(){g(o4,l1),g(o2,o2.current)}function ex(){l1=o4.current,h(o2),h(o4)}function eR(e){var n=e.alternate;g(o8,1&o8.current),g(o5,e),null===o6&&(null===n||null!==o2.current?o6=e:null!==n.memoizedState&&(o6=e))}function eC(e){if(22===e.tag){if(g(o8,o8.current),g(o5,e),null===o6){var n=e.alternate;null!==n&&null!==n.memoizedState&&(o6=e)}}else ey(e)}function ey(){g(o8,o8.current),g(o5,o5.current)}function eA(e){h(o5),o6===e&&(o6=null),h(o8)}function eP(e){for(var n=e;null!==n;){if(13===n.tag){var t=n.memoizedState;if(null!==t&&(null===(t=t.dehydrated)||ip(t)||im(t)))return n}else if(19===n.tag&&void 0!==n.memoizedProps.revealOrder){if(0!=(128&n.flags))return n}else if(null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}function ew(){throw Error(i(321))}function eL(e,n){if(null===n)return!1;for(var t=0;ti?i:8);var o=ai.T,l={};ai.T=l,nA(e,!1,n,t);try{var s=a(),u=ai.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;for(var e=0;e";case lk:return":has("+(t6(e)||"")+")";case lH:return'[role="'+e.value+'"]';case lz:return'"'+e.value+'"';case lV:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function t8(e,n){var t=[];e=[e,0];for(var r=0;rst&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304)}else{if(!r)if(null!==(e=eP(o))){if(n.flags|=128,r=!0,e=e.updateQueue,n.updateQueue=e,tb(n,e),tM(a,!0),null===a.tail&&"hidden"===a.tailMode&&!o.alternate&&!oP)return tx(n),null}else 2*oi()-a.renderingStartTime>st&&0x20000000!==t&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304);a.isBackwards?(o.sibling=n.child,n.child=o):(null!==(e=a.last)?e.sibling=o:n.child=o,a.last=o)}if(null!==a.tail)return n=a.tail,a.rendering=n,a.tail=n.sibling,a.renderingStartTime=oi(),n.sibling=null,e=o8.current,g(o8,r?1&e|2:1&e),n;return tx(n),null;case 22:case 23:return eA(n),ex(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(tx(n),6&n.subtreeFlags&&(n.flags|=8192)):tx(n),null!==(t=n.updateQueue)&&tb(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&h(ly),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),tn(lR),tx(n),null;case 25:return null}throw Error(i(156,n.tag))}(n.alternate,n,l1);if(null!==t){lY=t;return}if(null!==(n=n.sibling)){lY=n;return}lY=n=e}while(null!==n)0===l3&&(l3=5)}function rS(e,n){do{var t=function(e,n){switch(L(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return tn(lR),D(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return I(n),null;case 13:if(eA(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(i(340));k()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return h(o8),null;case 4:return D(),null;case 10:return tn(n.type),null;case 22:case 23:return eA(n),ex(),null!==e&&h(ly),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return tn(lR),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,lY=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){lY=e;return}lY=e=t}while(null!==e)l3=6,lY=null}function rE(e,n,t,r,a,o,l,s,u,c){var d=ai.T,f=aL();try{aw(2),ai.T=null,function(e,n,t,r,a,o,l,s){do rb();while(null!==so)if(0!=(6&lj))throw Error(i(327));var u,c,d=e.finishedWork;if(r=e.finishedLanes,null!==d){if(e.finishedWork=null,e.finishedLanes=0,d===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var f=d.lanes|d.childLanes;!function(e,n,t,r,a,i){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(t=o&~t;0t?32:t;t=ai.T;var a=aL();try{if(aw(r),ai.T=null,null===so)var o=!1;else{r=su,su=null;var l=so,s=sl;if(so=null,sl=0,0!=(6&lj))throw Error(i(331));var u=lj;if(lj|=4,t3(l.current),t$(l,l.current,s,r),lj=u,K(0,!1),od&&"function"==typeof od.onPostCommitFiberRoot)try{od.onPostCommitFiberRoot(oc,l)}catch(e){}o=!0}return o}finally{aw(a),ai.T=t,rT(e,n)}}return!1}function rM(e,n,t){n=y(t,n),n=nB(e.stateNode,n,2),null!==(e=ei(e,n,2))&&(M(e,2),Y(e))}function rx(e,n,t){if(3===e.tag)rM(e,e,t);else for(;null!==n;){if(3===n.tag){rM(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===sa||!sa.has(r))){e=y(t,e),null!==(r=ei(n,t=nG(2),2))&&(nk(t,r,n,e),M(r,2),Y(r));break}}n=n.return}}function rR(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new lX;var a=new Set;r.set(n,a)}else void 0===(a=r.get(n))&&(a=new Set,r.set(n,a));a.has(t)||(l0=!0,a.add(t),e=rC.bind(null,e,n,t),n.then(e,e))}function rC(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,lq===e&&(lK&t)===t&&(4===l3||3===l3&&(0x3c00000&lK)===lK&&300>oi()-sn?0==(2&lj)&&rs(e,0):l5|=t,l8===lK&&(l8=0)),Y(e)}function ry(e,n){0===n&&(n=T()),null!==(e=X(e,n))&&(M(e,n),Y(e))}function rA(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),ry(e,t)}function rP(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(t=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(n),ry(e,t)}function rw(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rL(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rU(e,n){var r=e.alternate;return null===r?((r=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rD(e,n){e.flags&=0x1e00002;var t=e.alternate;return null===t?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,e.type=t.type,e.dependencies=null===(n=t.dependencies)?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function rN(e,n,r,a,o,l){var s=0;if(a=e,"function"==typeof e)rL(e)&&(s=1);else if("string"==typeof e)s=iO&&iQ?iB(e,r,oM.current)?26:i3(e)?27:5:iO?iB(e,r,oM.current)?26:5:iQ&&i3(e)?27:5;else e:switch(e){case rZ:return rI(r.children,o,l,n);case rJ:s=8,o|=24;break;case r0:return(e=t(12,r,n,2|o)).elementType=r0,e.lanes=l,e;case r5:return(e=t(13,r,n,o)).elementType=r5,e.lanes=l,e;case r6:return(e=t(19,r,n,o)).elementType=r6,e.lanes=l,e;case r7:return rF(r,o,l,n);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r2:s=10;break e;case r3:s=9;break e;case r4:s=11;break e;case r8:s=14;break e;case r9:s=16,a=null;break e}s=29,r=Error(i(130,null===e?"null":typeof e,"")),a=null}return(n=t(s,r,n,o)).elementType=e,n.type=a,n.lanes=l,n}function rI(e,n,r,a){return(e=t(7,e,a,n)).lanes=r,e}function rF(e,n,r,a){(e=t(22,e,a,n)).elementType=r7,e.lanes=r;var o={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0==(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility|=2,rn(n,e,2))}},attach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0!=(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility&=-3,rn(n,e,2))}}};return e.stateNode=o,e}function rO(e,n,r){return(e=t(6,e,null,n)).lanes=r,e}function rB(e,n,r){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function rG(e,n,t,r,a,i,o,l){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=aM,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function rk(e,n,r,a,i,o,l,s,u,c,d,f){return e=new rG(e,n,r,l,s,u,c,f),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=tc(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:n},et(o),e}function rH(e){var n=e._reactInternals;if(void 0===n){if("function"==typeof e.render)throw Error(i(188));throw Error(i(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(n))?function e(n){var t=n.tag;if(5===t||26===t||27===t||6===t)return n;for(n=n.child;null!==n;){if(null!==(t=e(n)))return t;n=n.sibling}return null}(e):null)?null:ad(e.stateNode)}function rV(e,n,t,r,a,i){a=a?i5:i5,null===r.context?r.context=a:r.pendingContext=a,(r=ea(n)).payload={element:t},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(t=ei(e,r,n))&&(rn(t,e,n),eo(t,e,n))}function rz(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t>>=0)?32:31-(i8(e)/i9|0)|0},i8=Math.log,i9=Math.LN2,i7=128,oe=4194304,on=rq.unstable_scheduleCallback,ot=rq.unstable_cancelCallback,or=rq.unstable_shouldYield,oa=rq.unstable_requestPaint,oi=rq.unstable_now,oo=rq.unstable_ImmediatePriority,ol=rq.unstable_UserBlockingPriority,os=rq.unstable_NormalPriority,ou=rq.unstable_IdlePriority,oc=(rq.log,rq.unstable_setDisableYieldValue,null),od=null,of="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},op=new WeakMap,om=[],oh=0,og=null,o_=0,ov=[],oS=0,oE=null,oT=1,ob="",oM=m(null),ox=m(null),oR=m(null),oC=m(null),oy=null,oA=null,oP=!1,ow=null,oL=!1,oU=Error(i(519)),oD=[],oN=0,oI=0,oF=null,oO=null,oB=!1,oG=!1,ok=!1,oH=0,oV=null,oz=0,oW=0,oX=null,oj=!1,oq=!1,oY=Object.prototype.hasOwnProperty,oK=Error(i(460)),o$=Error(i(474)),oQ={then:function(){}},oZ=null,oJ=null,o0=0,o1=eT(!0),o3=eT(!1),o2=m(null),o4=m(0),o5=m(null),o6=null,o8=m(0),o9=0,o7=null,le=null,ln=null,lt=!1,lr=!1,la=!1,li=0,lo=0,ll=null,ls=0,lu=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},lc={readContext:tl,use:eV,useCallback:ew,useContext:ew,useEffect:ew,useImperativeHandle:ew,useLayoutEffect:ew,useInsertionEffect:ew,useMemo:ew,useReducer:ew,useRef:ew,useState:ew,useDebugValue:ew,useDeferredValue:ew,useTransition:ew,useSyncExternalStore:ew,useId:ew};lc.useCacheRefresh=ew,lc.useMemoCache=ew,lc.useHostTransitionStatus=ew,lc.useFormState=ew,lc.useActionState=ew,lc.useOptimistic=ew;var ld={readContext:tl,use:eV,useCallback:function(e,n){return eG().memoizedState=[e,void 0===n?null:n],e},useContext:tl,useEffect:ns,useImperativeHandle:function(e,n,t){t=null!=t?t.concat([e]):null,no(4194308,4,nf.bind(null,n,e),t)},useLayoutEffect:function(e,n){return no(4194308,4,e,n)},useInsertionEffect:function(e,n){no(4,2,e,n)},useMemo:function(e,n){var t=eG();n=void 0===n?null:n;var r=e();return t.memoizedState=[r,n],r},useReducer:function(e,n,t){var r=eG();if(void 0!==t)var a=t(n);else a=n;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=nR.bind(null,o7,e),[r.memoizedState,e]},useRef:function(e){return eG().memoizedState={current:e}},useState:function(e){var n=(e=e0(e)).queue,t=nC.bind(null,o7,n);return n.dispatch=t,[e.memoizedState,t]},useDebugValue:nm,useDeferredValue:function(e,n){return n_(eG(),e,n)},useTransition:function(){var e=e0(!1);return e=nS.bind(null,o7,e.queue,!0,!1),eG().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,t){var r=o7,a=eG();if(oP){if(void 0===t)throw Error(i(407));t=t()}else{if(t=n(),null===lq)throw Error(i(349));0!=(60&lK)||eK(r,n,t)}a.memoizedState=t;var o={value:t,getSnapshot:n};return a.queue=o,ns(eQ.bind(null,r,o,e),[e]),r.flags|=2048,na(9,e$.bind(null,r,o,t,n),{destroy:void 0},null),t},useId:function(){var e=eG(),n=lq.identifierPrefix;if(oP){var t=ob,r=oT;n=":"+n+"R"+(t=(r&~(1<<32-i6(r)-1)).toString(32)+t),0<(t=li++)&&(n+="H"+t.toString(32)),n+=":"}else n=":"+n+"r"+(t=ls++).toString(32)+":";return e.memoizedState=n},useCacheRefresh:function(){return eG().memoizedState=nx.bind(null,o7)}};ld.useMemoCache=ez,ld.useHostTransitionStatus=nT,ld.useFormState=e7,ld.useActionState=e7,ld.useOptimistic=function(e){var n=eG();n.memoizedState=n.baseState=e;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=t,n=nA.bind(null,o7,!0,t),t.dispatch=n,[e,n]};var lf={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eX,useRef:ni,useState:function(){return eX(eW)},useDebugValue:nm,useDeferredValue:function(e,n){return nv(ek(),le.memoizedState,e,n)},useTransition:function(){var e=eX(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lf.useCacheRefresh=nM,lf.useMemoCache=ez,lf.useHostTransitionStatus=nT,lf.useFormState=ne,lf.useActionState=ne,lf.useOptimistic=function(e,n){return e1(ek(),le,e,n)};var lp={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eq,useRef:ni,useState:function(){return eq(eW)},useDebugValue:nm,useDeferredValue:function(e,n){var t=ek();return null===le?n_(t,e,n):nv(t,le.memoizedState,e,n)},useTransition:function(){var e=eq(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lp.useCacheRefresh=nM,lp.useMemoCache=ez,lp.useHostTransitionStatus=nT,lp.useFormState=nr,lp.useActionState=nr,lp.useOptimistic=function(e,n){var t=ek();return null!==le?e1(t,le,e,n):(t.baseState=e,[e,t.queue.dispatch])};var lm={isMounted:function(e){return!!(e=e._reactInternals)&&d(e)===e},enqueueSetState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=t7(),r=ea(t);r.tag=2,null!=n&&(r.callback=n),null!==(n=ei(e,r,t))&&(rn(n,e,t),eo(n,e,t))}},lh="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},lg=Error(i(461)),l_=!1,lv={dehydrated:null,treeContext:null,retryLane:0},lS=m(null),lE=null,lT=null,lb="undefined"!=typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},lM=rq.unstable_scheduleCallback,lx=rq.unstable_NormalPriority,lR={$$typeof:r2,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},lC=ai.S;ai.S=function(e,n){"object"==typeof n&&null!==n&&"function"==typeof n.then&&function(e,n){if(null===oV){var t=oV=[];oz=0,oW=ee(),oX={status:"pending",value:void 0,then:function(e){t.push(e)}}}oz++,n.then(en,en)}(0,n),null!==lC&&lC(e,n)};var ly=m(null),lA=!1,lP=!1,lw=!1,lL="function"==typeof WeakSet?WeakSet:Set,lU=null,lD=!1,lN=null,lI=!1,lF=null,lO=8192,lB={getCacheForType:function(e){var n=tl(lR),t=n.data.get(e);return void 0===t&&(t=e(),n.data.set(e,t)),t}},lG=0,lk=1,lH=2,lV=3,lz=4;if("function"==typeof Symbol&&Symbol.for){var lW=Symbol.for;lG=lW("selector.component"),lk=lW("selector.has_pseudo_class"),lH=lW("selector.role"),lV=lW("selector.test_id"),lz=lW("selector.text")}var lX="function"==typeof WeakMap?WeakMap:Map,lj=0,lq=null,lY=null,lK=0,l$=0,lQ=null,lZ=!1,lJ=!1,l0=!1,l1=0,l3=0,l2=0,l4=0,l5=0,l6=0,l8=0,l9=null,l7=null,se=!1,sn=0,st=1/0,sr=null,sa=null,si=!1,so=null,sl=0,ss=0,su=null,sc=0,sd=null;return rX.attemptContinuousHydration=function(e){if(13===e.tag){var n=X(e,0x4000000);null!==n&&rn(n,e,0x4000000),rW(e,0x4000000)}},rX.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var n=t7(),t=X(e,n);null!==t&&rn(t,e,n),rW(e,n)}},rX.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var n=_(e.pendingLanes);if(0!==n){for(e.pendingLanes|=2,e.entangledLanes|=2;n;){var t=1<<31-i6(n);e.entanglements[1]|=t,n&=~t}Y(e),0==(6&lj)&&(st=oi()+500,K(0,!1))}}break;case 13:null!==(n=X(e,2))&&rn(n,e,2),ro(),rW(e,2)}},rX.batchedUpdates=function(e,n){return e(n)},rX.createComponentSelector=function(e){return{$$typeof:lG,value:e}},rX.createContainer=function(e,n,t,r,a,i,o,l,s,u){return rk(e,n,!1,null,t,r,i,o,l,s,u,null)},rX.createHasPseudoClassSelector=function(e){return{$$typeof:lk,value:e}},rX.createHydrationContainer=function(e,n,t,r,a,i,o,l,s,u,c,d,f){var p;return(e=rk(t,r,!0,e,a,i,l,s,u,c,d,f)).context=(p=null,i5),t=e.current,(a=ea(r=t7())).callback=null!=n?n:null,ei(t,a,r),e.current.lanes=r,M(e,r),Y(e),e},rX.createPortal=function(e,n,t){var r=3=c&&o>=f&&a<=d&&l<=p){e.splice(n,1);break}if(r!==c||t.width!==u.width||pl){if(!(o!==f||t.height!==u.height||da)){c>r&&(u.width+=c-r,u.x=r),do&&(u.height+=f-o,u.y=o),pt&&(t=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},rX.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return ad(e.child.stateNode);default:return e.child.stateNode}},rX.injectIntoDevTools=function(){var e={bundleType:0,version:as,rendererPackageName:au,currentDispatcherRef:ai,findFiberByHostInstance:aA,reconcilerVersion:"19.0.0"};if(null!==ac&&(e.rendererConfig=ac),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{oc=n.inject(e),od=n}catch(e){}e=!!n.checkDCE}}return e},rX.isAlreadyRendering=function(){return!1},rX.observeVisibleRects=function(e,n,t,r){if(!aX)throw Error(i(363));var a=aZ(e=t9(e,n),t,r).disconnect;return{disconnect:function(){a()}}},rX.shouldError=function(){return null},rX.shouldSuspend=function(){return!1},rX.startHostTransition=function(e,n,t,r){if(5!==e.tag)throw Error(i(476));var o=nE(e).queue;nS(e,o,n,ak,null===t?a:function(){var n=nE(e).next.queue;return ny(e,n,{},t7()),t(r)})},rX.updateContainer=function(e,n,t,r){var a=n.current,i=t7();return rV(a,i,e,n,t,r),i},rX.updateContainerSync=function(e,n,t,r){return 0===n.tag&&rb(),rV(n.current,2,e,n,t,r),2},rX},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})},98133,(e,n,t)=>{"use strict";n.exports=e.r(40336)},45015,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},95087,(e,n,t)=>{"use strict";n.exports=e.r(45015)},91037,8560,8155,46791,e=>{"use strict";let n,t,r,a,i,o,l,s,u;var c,d,f,p=e.i(71645),m=e.i(39695),h=e.i(90072),g=h;function _(){let e=null,n=!1,t=null,r=null;function a(n,i){t(n,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===n||null!==t&&(r=e.requestAnimationFrame(a),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(e){t=e},setContext:function(n){e=n}}}function v(e){let n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){let e=n.get(t);(!e||e.versione.start-n.start);let n=0;for(let e=1;e 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},E={common:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new g.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new g.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new g.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new g.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new g.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new g.Matrix3},normalScale:{value:new g.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new g.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new g.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new g.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new g.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new g.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0},uvTransform:{value:new g.Matrix3}},sprite:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},center:{value:new g.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}}},T={basic:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.fog]),vertexShader:S.meshbasic_vert,fragmentShader:S.meshbasic_frag},lambert:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshlambert_vert,fragmentShader:S.meshlambert_frag},phong:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},specular:{value:new g.Color(1118481)},shininess:{value:30}}]),vertexShader:S.meshphong_vert,fragmentShader:S.meshphong_frag},standard:{uniforms:(0,g.mergeUniforms)([E.common,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.roughnessmap,E.metalnessmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag},toon:{uniforms:(0,g.mergeUniforms)([E.common,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.gradientmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshtoon_vert,fragmentShader:S.meshtoon_frag},matcap:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,E.fog,{matcap:{value:null}}]),vertexShader:S.meshmatcap_vert,fragmentShader:S.meshmatcap_frag},points:{uniforms:(0,g.mergeUniforms)([E.points,E.fog]),vertexShader:S.points_vert,fragmentShader:S.points_frag},dashed:{uniforms:(0,g.mergeUniforms)([E.common,E.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:S.linedashed_vert,fragmentShader:S.linedashed_frag},depth:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap]),vertexShader:S.depth_vert,fragmentShader:S.depth_frag},normal:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,{opacity:{value:1}}]),vertexShader:S.meshnormal_vert,fragmentShader:S.meshnormal_frag},sprite:{uniforms:(0,g.mergeUniforms)([E.sprite,E.fog]),vertexShader:S.sprite_vert,fragmentShader:S.sprite_frag},background:{uniforms:{uvTransform:{value:new g.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:S.background_vert,fragmentShader:S.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new g.Matrix3}},vertexShader:S.backgroundCube_vert,fragmentShader:S.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:S.cube_vert,fragmentShader:S.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:S.equirect_vert,fragmentShader:S.equirect_frag},distance:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap,{referencePosition:{value:new g.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:S.distance_vert,fragmentShader:S.distance_frag},shadow:{uniforms:(0,g.mergeUniforms)([E.lights,E.fog,{color:{value:new g.Color(0)},opacity:{value:1}}]),vertexShader:S.shadow_vert,fragmentShader:S.shadow_frag}};T.physical={uniforms:(0,g.mergeUniforms)([T.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new g.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new g.Matrix3},clearcoatNormalScale:{value:new g.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new g.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new g.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new g.Matrix3},sheen:{value:0},sheenColor:{value:new g.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new g.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new g.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new g.Matrix3},transmissionSamplerSize:{value:new g.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new g.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new g.Color(0)},specularColor:{value:new g.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new g.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new g.Matrix3},anisotropyVector:{value:new g.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new g.Matrix3}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag};let b={r:0,b:0,g:0},M=new g.Euler,x=new g.Matrix4;function R(e,n,t,r,a,i,o){let l,s,u=new g.Color(0),c=+(!0!==i),d=null,f=0,p=null;function m(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?t:n).get(r)),r}function h(n,t){n.getRGB(b,(0,g.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(b.r,b.g,b.b,t,o)}return{getClearColor:function(){return u},setClearColor:function(e,n=1){u.set(e),h(u,c=n)},getClearAlpha:function(){return c},setClearAlpha:function(e){h(u,c=e)},render:function(n){let t=!1,a=m(n);null===a?h(u,c):a&&a.isColor&&(h(a,1),t=!0);let i=e.xr.getEnvironmentBlendMode();"additive"===i?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===i&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||t)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,t){let r=m(t);r&&(r.isCubeTexture||r.mapping===g.CubeUVReflectionMapping)?(void 0===s&&((s=new g.Mesh(new g.BoxGeometry(1,1,1),new g.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,g.cloneUniforms)(T.backgroundCube.uniforms),vertexShader:T.backgroundCube.vertexShader,fragmentShader:T.backgroundCube.fragmentShader,side:g.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,n,t){this.matrixWorld.copyPosition(t.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(s)),M.copy(t.backgroundRotation),M.x*=-1,M.y*=-1,M.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(M.y*=-1,M.z*=-1),s.material.uniforms.envMap.value=r,s.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,s.material.uniforms.backgroundBlurriness.value=t.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(x.makeRotationFromEuler(M)),s.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,(d!==r||f!==r.version||p!==e.toneMapping)&&(s.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new g.Mesh(new g.PlaneGeometry(2,2),new g.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,g.cloneUniforms)(T.background.uniforms),vertexShader:T.background.vertexShader,fragmentShader:T.background.fragmentShader,side:g.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,l.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function C(e,n){let t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(n){return e.bindVertexArray(n)}function s(n){return e.deleteVertexArray(n)}function u(e){let n=[],r=[],a=[];for(let e=0;e=0){let t=a[n],r=o[n];if(void 0===r&&("instanceMatrix"===n&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(r=e.instanceColor)),void 0===t||t.attribute!==r||r&&t.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(t,h,s,_))&&function(e,n,t,r){let a={},o=n.attributes,l=0,s=t.getAttributes();for(let n in s)if(s[n].location>=0){let t=o[n];void 0===t&&("instanceMatrix"===n&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(t=e.instanceColor));let r={};r.attribute=t,t&&t.data&&(r.data=t.data),a[n]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(t,h,s,_),null!==_&&n.update(_,e.ELEMENT_ARRAY_BUFFER),(x||o)&&(o=!1,function(t,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&t.instanceMatrix&&(l=t.instanceMatrix),"instanceColor"===r&&t.instanceColor&&(l=t.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=n.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===g.IntType;if(l.isInterleavedBufferAttribute){let n=l.data,s=n.stride,g=l.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";n="mediump"}return"mediump"===n&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==t.precision?t.precision:"highp",l=i(o);return l!==o&&((0,g.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(n){return n===g.RGBAFormat||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(t){let a=t===g.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return t===g.UnsignedByteType||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||t===g.FloatType||!!a},precision:o,logarithmicDepthBuffer:!0===t.logarithmicDepthBuffer,reversedDepthBuffer:!0===t.reversedDepthBuffer&&n.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function P(e){let n=this,t=null,r=0,a=!1,i=!1,o=new g.Plane,l=new g.Matrix3,s={value:null,needsUpdate:!1};function u(e,t,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let n=r+4*i,a=t.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length0),n.numPlanes=r,n.numIntersection=0)}}function w(e){let n=new WeakMap;function t(e,n){return n===g.EquirectangularReflectionMapping?e.mapping=g.CubeReflectionMapping:n===g.EquirectangularRefractionMapping&&(e.mapping=g.CubeRefractionMapping),e}function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping;if(i===g.EquirectangularReflectionMapping||i===g.EquirectangularRefractionMapping)if(n.has(a))return t(n.get(a).texture,a.mapping);else{let i=a.image;if(!i||!(i.height>0))return null;{let o=new g.WebGLCubeRenderTarget(i.height);return o.fromEquirectangularTexture(e,a),n.set(a,o),a.addEventListener("dispose",r),t(o.texture,a.mapping)}}}return a},dispose:function(){n=new WeakMap}}}let L=[.125,.215,.35,.446,.526,.582],U=new g.OrthographicCamera,D=new g.Color,N=null,I=0,F=0,O=!1,B=new g.Vector3;class G{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,t=.1,r=100,a={}){let{size:i=256,position:o=B}=a;N=this._renderer.getRenderTarget(),I=this._renderer.getActiveCubeFace(),F=this._renderer.getActiveMipmapLevel(),O=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,t,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=z(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=V(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=L[o-e+4-1]:0===o&&(l=0),t.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let n=e%3*2/3-1,t=e>2?0:-1,r=[n,t,0,n+2/3,t,0,n+2/3,t+1,0,n,t,0,n+2/3,t+1,0,n,t+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new g.BufferGeometry;h.setAttribute("position",new g.BufferAttribute(f,3)),h.setAttribute("uv",new g.BufferAttribute(p,2)),h.setAttribute("faceIndex",new g.BufferAttribute(m,1)),r.push(new g.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:n,sigmas:t}}(d)),this._blurMaterial=(a=d,i=e,o=n,r=new Float32Array(20),c=new g.Vector3(0,1,0),new g.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:W(),fragmentShader:` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,24478,(e,n,t)=>{"use strict";t.ConcurrentRoot=1,t.ContinuousEventPriority=8,t.DefaultEventPriority=32,t.DiscreteEventPriority=2,t.IdleEventPriority=0x10000000,t.LegacyRoot=0,t.NoEventPriority=0},39695,(e,n,t)=>{"use strict";n.exports=e.r(24478)},55838,(e,n,t)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var t=n();return!a(e,t)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),r=i({inst:{value:t,getSnapshot:n}}),a=r[0].inst,c=r[1];return l(function(){a.value=t,a.getSnapshot=n,u(a)&&c({inst:a})},[e,t,n]),o(function(){return u(a)&&c({inst:a}),e(function(){u(a)&&c({inst:a})})},[e]),s(t),t};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,n,t)=>{"use strict";n.exports=e.r(55838)},52822,(e,n,t)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,n,t,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var n=f.value;if(a(n,e))return l=n}return l=e}if(n=l,i(o,e))return n;var t=r(e);return void 0!==a&&a(n,t)?(o=e,n):(o=e,l=t)}var o,l,s=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]},[n,t,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,n,t)=>{"use strict";n.exports=e.r(52822)},29779,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},28563,(e,n,t)=>{"use strict";n.exports=e.r(29779)},40336,(e,n,t)=>{"use strict";var r=e.i(47167);n.exports=function(n){function t(e,n,t,r){return new rw(e,n,t,r)}function a(){}function i(e){var n="https://react.dev/errors/"+e;if(1)":-1a||u[r]!==c[a]){var d="\n"+u[r].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=r&&0<=a)break}}}finally{ao=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?s(t):""}function c(e){try{var n="";do n+=function(e){switch(e.tag){case 26:case 27:case 5:return s(e.type);case 16:return s("Lazy");case 13:return s("Suspense");case 19:return s("SuspenseList");case 0:case 15:return u(e.type,!1);case 11:return u(e.type.render,!1);case 1:return u(e.type,!0);default:return""}}(e),e=e.return;while(e)return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function d(e){var n=e,t=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do 0!=(4098&(n=e).flags)&&(t=n.return),e=n.return;while(e)}return 3===n.tag?t:null}function f(e){if(d(e)!==e)throw Error(i(188))}function p(e){var n=e.alternate;if(!n){if(null===(n=d(e)))throw Error(i(188));return n!==e?null:e}for(var t=e,r=n;;){var a=t.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){t=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===t)return f(a),e;if(o===r)return f(a),n;o=o.sibling}throw Error(i(188))}if(t.return!==r.return)t=a,r=o;else{for(var l=!1,s=a.child;s;){if(s===t){l=!0,t=a,r=o;break}if(s===r){l=!0,r=a,t=o;break}s=s.sibling}if(!l){for(s=o.child;s;){if(s===t){l=!0,t=o,r=a;break}if(s===r){l=!0,r=o,t=a;break}s=s.sibling}if(!l)throw Error(i(189))}}if(t.alternate!==r)throw Error(i(190))}if(3!==t.tag)throw Error(i(188));return t.stateNode.current===t?e:n}function m(e){return{current:e}}function h(e){0>i4||(e.current=i2[i4],i2[i4]=null,i4--)}function g(e,n){i2[++i4]=e.current,e.current=n}function _(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function v(e,n){var t=e.pendingLanes;if(0===t)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,o=e.warmLanes;e=0!==e.finishedLanes;var l=0x7ffffff&t;return 0!==l?0!=(t=l&~a)?r=_(t):0!=(i&=l)?r=_(i):e||0!=(o=l&~o)&&(r=_(o)):0!=(l=t&~a)?r=_(l):0!==i?r=_(i):e||0!=(o=t&~o)&&(r=_(o)),0===r?0:0!==n&&n!==r&&0==(n&a)&&((a=r&-r)>=(o=n&-n)||32===a&&0!=(4194176&o))?n:r}function S(e,n){return 0==(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function E(){var e=i7;return 0==(4194176&(i7<<=1))&&(i7=128),e}function T(){var e=oe;return 0==(0x3c00000&(oe<<=1))&&(oe=4194304),e}function b(e){for(var n=[],t=0;31>t;t++)n.push(e);return n}function M(e,n){e.pendingLanes|=n,0x10000000!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function x(e,n,t){e.pendingLanes|=n,e.suspendedLanes&=~n;var r=31-i6(n);e.entangledLanes|=n,e.entanglements[r]=0x40000000|e.entanglements[r]|4194218&t}function R(e,n){var t=e.entangledLanes|=n;for(e=e.entanglements;t;){var r=31-i6(t),a=1<>=o,a-=o,oT=1<<32-i6(n)+a|t<f?(p=d,d=null):p=d.sibling;var _=h(t,d,o[f],l);if(null===_){null===d&&(d=p);break}e&&d&&null===_.alternate&&n(t,d),i=s(_,i,f),null===c?u=_:c.sibling=_,c=_,d=p}if(f===o.length)return r(t,d),oP&&A(t,f),u;if(null===d){for(;fp?(_=f,f=null):_=f.sibling;var S=h(t,f,v.value,u);if(null===S){null===f&&(f=_);break}e&&f&&null===S.alternate&&n(t,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=_}if(v.done)return r(t,f),oP&&A(t,p),c;if(null===f){for(;!v.done;p++,v=l.next())null!==(v=m(t,v.value,u))&&(o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return oP&&A(t,p),c}for(f=a(f);!v.done;p++,v=l.next())null!==(v=g(f,t,p,v.value,u))&&(e&&null!==v.alternate&&f.delete(null===v.key?p:v.key),o=s(v,o,p),null===d?c=v:d.sibling=v,d=v);return e&&f.forEach(function(e){return n(t,e)}),oP&&A(t,p),c}(c,d,f=_.call(f),p)}if("function"==typeof f.then)return t(c,d,e_(f),p);if(f.$$typeof===r2)return t(c,d,ts(c,f),p);eS(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(r(c,d.sibling),(p=l(d,f)).return=c):(r(c,d),(p=rO(f,c.mode,p)).return=c),u(c=p)):r(c,d)}(c,d,f,p);return oJ=null,_}catch(e){if(e===oK)throw e;var v=t(29,e,null,c.mode);return v.lanes=p,v.return=c,v}finally{}}}function eb(e,n){g(o4,e=l1),g(o2,n),l1=e|n.baseLanes}function eM(){g(o4,l1),g(o2,o2.current)}function ex(){l1=o4.current,h(o2),h(o4)}function eR(e){var n=e.alternate;g(o8,1&o8.current),g(o5,e),null===o6&&(null===n||null!==o2.current?o6=e:null!==n.memoizedState&&(o6=e))}function eC(e){if(22===e.tag){if(g(o8,o8.current),g(o5,e),null===o6){var n=e.alternate;null!==n&&null!==n.memoizedState&&(o6=e)}}else ey(e)}function ey(){g(o8,o8.current),g(o5,o5.current)}function eA(e){h(o5),o6===e&&(o6=null),h(o8)}function eP(e){for(var n=e;null!==n;){if(13===n.tag){var t=n.memoizedState;if(null!==t&&(null===(t=t.dehydrated)||ip(t)||im(t)))return n}else if(19===n.tag&&void 0!==n.memoizedProps.revealOrder){if(0!=(128&n.flags))return n}else if(null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}function ew(){throw Error(i(321))}function eL(e,n){if(null===n)return!1;for(var t=0;ti?i:8);var o=ai.T,l={};ai.T=l,nA(e,!1,n,t);try{var s=a(),u=ai.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;for(var e=0;e";case lk:return":has("+(t6(e)||"")+")";case lH:return'[role="'+e.value+'"]';case lz:return'"'+e.value+'"';case lV:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function t8(e,n){var t=[];e=[e,0];for(var r=0;rst&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304)}else{if(!r)if(null!==(e=eP(o))){if(n.flags|=128,r=!0,e=e.updateQueue,n.updateQueue=e,tb(n,e),tM(a,!0),null===a.tail&&"hidden"===a.tailMode&&!o.alternate&&!oP)return tx(n),null}else 2*oi()-a.renderingStartTime>st&&0x20000000!==t&&(n.flags|=128,r=!0,tM(a,!1),n.lanes=4194304);a.isBackwards?(o.sibling=n.child,n.child=o):(null!==(e=a.last)?e.sibling=o:n.child=o,a.last=o)}if(null!==a.tail)return n=a.tail,a.rendering=n,a.tail=n.sibling,a.renderingStartTime=oi(),n.sibling=null,e=o8.current,g(o8,r?1&e|2:1&e),n;return tx(n),null;case 22:case 23:return eA(n),ex(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?0!=(0x20000000&t)&&0==(128&n.flags)&&(tx(n),6&n.subtreeFlags&&(n.flags|=8192)):tx(n),null!==(t=n.updateQueue)&&tb(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&h(ly),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),tn(lR),tx(n),null;case 25:return null}throw Error(i(156,n.tag))}(n.alternate,n,l1);if(null!==t){lY=t;return}if(null!==(n=n.sibling)){lY=n;return}lY=n=e}while(null!==n)0===l3&&(l3=5)}function rS(e,n){do{var t=function(e,n){switch(L(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return tn(lR),D(),0!=(65536&(e=n.flags))&&0==(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return I(n),null;case 13:if(eA(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(i(340));k()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return h(o8),null;case 4:return D(),null;case 10:return tn(n.type),null;case 22:case 23:return eA(n),ex(),null!==e&&h(ly),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return tn(lR),null;default:return null}}(e.alternate,e);if(null!==t){t.flags&=32767,lY=t;return}if(null!==(t=e.return)&&(t.flags|=32768,t.subtreeFlags=0,t.deletions=null),!n&&null!==(e=e.sibling)){lY=e;return}lY=e=t}while(null!==e)l3=6,lY=null}function rE(e,n,t,r,a,o,l,s,u,c){var d=ai.T,f=aL();try{aw(2),ai.T=null,function(e,n,t,r,a,o,l,s){do rb();while(null!==so)if(0!=(6&lj))throw Error(i(327));var u,c,d=e.finishedWork;if(r=e.finishedLanes,null!==d){if(e.finishedWork=null,e.finishedLanes=0,d===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var f=d.lanes|d.childLanes;!function(e,n,t,r,a,i){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(t=o&~t;0t?32:t;t=ai.T;var a=aL();try{if(aw(r),ai.T=null,null===so)var o=!1;else{r=su,su=null;var l=so,s=sl;if(so=null,sl=0,0!=(6&lj))throw Error(i(331));var u=lj;if(lj|=4,t3(l.current),t$(l,l.current,s,r),lj=u,K(0,!1),od&&"function"==typeof od.onPostCommitFiberRoot)try{od.onPostCommitFiberRoot(oc,l)}catch(e){}o=!0}return o}finally{aw(a),ai.T=t,rT(e,n)}}return!1}function rM(e,n,t){n=y(t,n),n=nB(e.stateNode,n,2),null!==(e=ei(e,n,2))&&(M(e,2),Y(e))}function rx(e,n,t){if(3===e.tag)rM(e,e,t);else for(;null!==n;){if(3===n.tag){rM(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===sa||!sa.has(r))){e=y(t,e),null!==(r=ei(n,t=nG(2),2))&&(nk(t,r,n,e),M(r,2),Y(r));break}}n=n.return}}function rR(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new lX;var a=new Set;r.set(n,a)}else void 0===(a=r.get(n))&&(a=new Set,r.set(n,a));a.has(t)||(l0=!0,a.add(t),e=rC.bind(null,e,n,t),n.then(e,e))}function rC(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,lq===e&&(lK&t)===t&&(4===l3||3===l3&&(0x3c00000&lK)===lK&&300>oi()-sn?0==(2&lj)&&rs(e,0):l5|=t,l8===lK&&(l8=0)),Y(e)}function ry(e,n){0===n&&(n=T()),null!==(e=X(e,n))&&(M(e,n),Y(e))}function rA(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),ry(e,t)}function rP(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(t=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(n),ry(e,t)}function rw(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rL(e){return!(!(e=e.prototype)||!e.isReactComponent)}function rU(e,n){var r=e.alternate;return null===r?((r=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x1e00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function rD(e,n){e.flags&=0x1e00002;var t=e.alternate;return null===t?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,e.type=t.type,e.dependencies=null===(n=t.dependencies)?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function rN(e,n,r,a,o,l){var s=0;if(a=e,"function"==typeof e)rL(e)&&(s=1);else if("string"==typeof e)s=iO&&iQ?iB(e,r,oM.current)?26:i3(e)?27:5:iO?iB(e,r,oM.current)?26:5:iQ&&i3(e)?27:5;else e:switch(e){case rZ:return rI(r.children,o,l,n);case rJ:s=8,o|=24;break;case r0:return(e=t(12,r,n,2|o)).elementType=r0,e.lanes=l,e;case r5:return(e=t(13,r,n,o)).elementType=r5,e.lanes=l,e;case r6:return(e=t(19,r,n,o)).elementType=r6,e.lanes=l,e;case r7:return rF(r,o,l,n);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case r1:case r2:s=10;break e;case r3:s=9;break e;case r4:s=11;break e;case r8:s=14;break e;case r9:s=16,a=null;break e}s=29,r=Error(i(130,null===e?"null":typeof e,"")),a=null}return(n=t(s,r,n,o)).elementType=e,n.type=a,n.lanes=l,n}function rI(e,n,r,a){return(e=t(7,e,a,n)).lanes=r,e}function rF(e,n,r,a){(e=t(22,e,a,n)).elementType=r7,e.lanes=r;var o={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0==(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility|=2,rn(n,e,2))}},attach:function(){var e=o._current;if(null===e)throw Error(i(456));if(0!=(2&o._pendingVisibility)){var n=X(e,2);null!==n&&(o._pendingVisibility&=-3,rn(n,e,2))}}};return e.stateNode=o,e}function rO(e,n,r){return(e=t(6,e,null,n)).lanes=r,e}function rB(e,n,r){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function rG(e,n,t,r,a,i,o,l){this.tag=1,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=aM,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function rk(e,n,r,a,i,o,l,s,u,c,d,f){return e=new rG(e,n,r,l,s,u,c,f),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=tc(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:n},et(o),e}function rH(e){var n=e._reactInternals;if(void 0===n){if("function"==typeof e.render)throw Error(i(188));throw Error(i(268,e=Object.keys(e).join(",")))}return null===(e=null!==(e=p(n))?function e(n){var t=n.tag;if(5===t||26===t||27===t||6===t)return n;for(n=n.child;null!==n;){if(null!==(t=e(n)))return t;n=n.sibling}return null}(e):null)?null:ad(e.stateNode)}function rV(e,n,t,r,a,i){a=a?i5:i5,null===r.context?r.context=a:r.pendingContext=a,(r=ea(n)).payload={element:t},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(t=ei(e,r,n))&&(rn(t,e,n),eo(t,e,n))}function rz(e,n){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var t=e.retryLane;e.retryLane=0!==t&&t>>=0)?32:31-(i8(e)/i9|0)|0},i8=Math.log,i9=Math.LN2,i7=128,oe=4194304,on=rq.unstable_scheduleCallback,ot=rq.unstable_cancelCallback,or=rq.unstable_shouldYield,oa=rq.unstable_requestPaint,oi=rq.unstable_now,oo=rq.unstable_ImmediatePriority,ol=rq.unstable_UserBlockingPriority,os=rq.unstable_NormalPriority,ou=rq.unstable_IdlePriority,oc=(rq.log,rq.unstable_setDisableYieldValue,null),od=null,of="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},op=new WeakMap,om=[],oh=0,og=null,o_=0,ov=[],oS=0,oE=null,oT=1,ob="",oM=m(null),ox=m(null),oR=m(null),oC=m(null),oy=null,oA=null,oP=!1,ow=null,oL=!1,oU=Error(i(519)),oD=[],oN=0,oI=0,oF=null,oO=null,oB=!1,oG=!1,ok=!1,oH=0,oV=null,oz=0,oW=0,oX=null,oj=!1,oq=!1,oY=Object.prototype.hasOwnProperty,oK=Error(i(460)),o$=Error(i(474)),oQ={then:function(){}},oZ=null,oJ=null,o0=0,o1=eT(!0),o3=eT(!1),o2=m(null),o4=m(0),o5=m(null),o6=null,o8=m(0),o9=0,o7=null,le=null,ln=null,lt=!1,lr=!1,la=!1,li=0,lo=0,ll=null,ls=0,lu=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},lc={readContext:tl,use:eV,useCallback:ew,useContext:ew,useEffect:ew,useImperativeHandle:ew,useLayoutEffect:ew,useInsertionEffect:ew,useMemo:ew,useReducer:ew,useRef:ew,useState:ew,useDebugValue:ew,useDeferredValue:ew,useTransition:ew,useSyncExternalStore:ew,useId:ew};lc.useCacheRefresh=ew,lc.useMemoCache=ew,lc.useHostTransitionStatus=ew,lc.useFormState=ew,lc.useActionState=ew,lc.useOptimistic=ew;var ld={readContext:tl,use:eV,useCallback:function(e,n){return eG().memoizedState=[e,void 0===n?null:n],e},useContext:tl,useEffect:ns,useImperativeHandle:function(e,n,t){t=null!=t?t.concat([e]):null,no(4194308,4,nf.bind(null,n,e),t)},useLayoutEffect:function(e,n){return no(4194308,4,e,n)},useInsertionEffect:function(e,n){no(4,2,e,n)},useMemo:function(e,n){var t=eG();n=void 0===n?null:n;var r=e();return t.memoizedState=[r,n],r},useReducer:function(e,n,t){var r=eG();if(void 0!==t)var a=t(n);else a=n;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=nR.bind(null,o7,e),[r.memoizedState,e]},useRef:function(e){return eG().memoizedState={current:e}},useState:function(e){var n=(e=e0(e)).queue,t=nC.bind(null,o7,n);return n.dispatch=t,[e.memoizedState,t]},useDebugValue:nm,useDeferredValue:function(e,n){return n_(eG(),e,n)},useTransition:function(){var e=e0(!1);return e=nS.bind(null,o7,e.queue,!0,!1),eG().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,t){var r=o7,a=eG();if(oP){if(void 0===t)throw Error(i(407));t=t()}else{if(t=n(),null===lq)throw Error(i(349));0!=(60&lK)||eK(r,n,t)}a.memoizedState=t;var o={value:t,getSnapshot:n};return a.queue=o,ns(eQ.bind(null,r,o,e),[e]),r.flags|=2048,na(9,e$.bind(null,r,o,t,n),{destroy:void 0},null),t},useId:function(){var e=eG(),n=lq.identifierPrefix;if(oP){var t=ob,r=oT;n=":"+n+"R"+(t=(r&~(1<<32-i6(r)-1)).toString(32)+t),0<(t=li++)&&(n+="H"+t.toString(32)),n+=":"}else n=":"+n+"r"+(t=ls++).toString(32)+":";return e.memoizedState=n},useCacheRefresh:function(){return eG().memoizedState=nx.bind(null,o7)}};ld.useMemoCache=ez,ld.useHostTransitionStatus=nT,ld.useFormState=e7,ld.useActionState=e7,ld.useOptimistic=function(e){var n=eG();n.memoizedState=n.baseState=e;var t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=t,n=nA.bind(null,o7,!0,t),t.dispatch=n,[e,n]};var lf={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eX,useRef:ni,useState:function(){return eX(eW)},useDebugValue:nm,useDeferredValue:function(e,n){return nv(ek(),le.memoizedState,e,n)},useTransition:function(){var e=eX(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lf.useCacheRefresh=nM,lf.useMemoCache=ez,lf.useHostTransitionStatus=nT,lf.useFormState=ne,lf.useActionState=ne,lf.useOptimistic=function(e,n){return e1(ek(),le,e,n)};var lp={readContext:tl,use:eV,useCallback:nh,useContext:tl,useEffect:nu,useImperativeHandle:np,useInsertionEffect:nc,useLayoutEffect:nd,useMemo:ng,useReducer:eq,useRef:ni,useState:function(){return eq(eW)},useDebugValue:nm,useDeferredValue:function(e,n){var t=ek();return null===le?n_(t,e,n):nv(t,le.memoizedState,e,n)},useTransition:function(){var e=eq(eW)[0],n=ek().memoizedState;return["boolean"==typeof e?e:eH(e),n]},useSyncExternalStore:eY,useId:nb};lp.useCacheRefresh=nM,lp.useMemoCache=ez,lp.useHostTransitionStatus=nT,lp.useFormState=nr,lp.useActionState=nr,lp.useOptimistic=function(e,n){var t=ek();return null!==le?e1(t,le,e,n):(t.baseState=e,[e,t.queue.dispatch])};var lm={isMounted:function(e){return!!(e=e._reactInternals)&&d(e)===e},enqueueSetState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueReplaceState:function(e,n,t){e=e._reactInternals;var r=t7(),a=ea(r);a.tag=1,a.payload=n,null!=t&&(a.callback=t),null!==(n=ei(e,a,r))&&(rn(n,e,r),eo(n,e,r))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var t=t7(),r=ea(t);r.tag=2,null!=n&&(r.callback=n),null!==(n=ei(e,r,t))&&(rn(n,e,t),eo(n,e,t))}},lh="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if("object"==typeof r.default&&"function"==typeof r.default.emit)return void r.default.emit("uncaughtException",e);console.error(e)},lg=Error(i(461)),l_=!1,lv={dehydrated:null,treeContext:null,retryLane:0},lS=m(null),lE=null,lT=null,lb="undefined"!=typeof AbortController?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(n,t){e.push(t)}};this.abort=function(){n.aborted=!0,e.forEach(function(e){return e()})}},lM=rq.unstable_scheduleCallback,lx=rq.unstable_NormalPriority,lR={$$typeof:r2,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},lC=ai.S;ai.S=function(e,n){"object"==typeof n&&null!==n&&"function"==typeof n.then&&function(e,n){if(null===oV){var t=oV=[];oz=0,oW=ee(),oX={status:"pending",value:void 0,then:function(e){t.push(e)}}}oz++,n.then(en,en)}(0,n),null!==lC&&lC(e,n)};var ly=m(null),lA=!1,lP=!1,lw=!1,lL="function"==typeof WeakSet?WeakSet:Set,lU=null,lD=!1,lN=null,lI=!1,lF=null,lO=8192,lB={getCacheForType:function(e){var n=tl(lR),t=n.data.get(e);return void 0===t&&(t=e(),n.data.set(e,t)),t}},lG=0,lk=1,lH=2,lV=3,lz=4;if("function"==typeof Symbol&&Symbol.for){var lW=Symbol.for;lG=lW("selector.component"),lk=lW("selector.has_pseudo_class"),lH=lW("selector.role"),lV=lW("selector.test_id"),lz=lW("selector.text")}var lX="function"==typeof WeakMap?WeakMap:Map,lj=0,lq=null,lY=null,lK=0,l$=0,lQ=null,lZ=!1,lJ=!1,l0=!1,l1=0,l3=0,l2=0,l4=0,l5=0,l6=0,l8=0,l9=null,l7=null,se=!1,sn=0,st=1/0,sr=null,sa=null,si=!1,so=null,sl=0,ss=0,su=null,sc=0,sd=null;return rX.attemptContinuousHydration=function(e){if(13===e.tag){var n=X(e,0x4000000);null!==n&&rn(n,e,0x4000000),rW(e,0x4000000)}},rX.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag){var n=t7(),t=X(e,n);null!==t&&rn(t,e,n),rW(e,n)}},rX.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var n=_(e.pendingLanes);if(0!==n){for(e.pendingLanes|=2,e.entangledLanes|=2;n;){var t=1<<31-i6(n);e.entanglements[1]|=t,n&=~t}Y(e),0==(6&lj)&&(st=oi()+500,K(0,!1))}}break;case 13:null!==(n=X(e,2))&&rn(n,e,2),ro(),rW(e,2)}},rX.batchedUpdates=function(e,n){return e(n)},rX.createComponentSelector=function(e){return{$$typeof:lG,value:e}},rX.createContainer=function(e,n,t,r,a,i,o,l,s,u){return rk(e,n,!1,null,t,r,i,o,l,s,u,null)},rX.createHasPseudoClassSelector=function(e){return{$$typeof:lk,value:e}},rX.createHydrationContainer=function(e,n,t,r,a,i,o,l,s,u,c,d,f){var p;return(e=rk(t,r,!0,e,a,i,l,s,u,c,d,f)).context=(p=null,i5),t=e.current,(a=ea(r=t7())).callback=null!=n?n:null,ei(t,a,r),e.current.lanes=r,M(e,r),Y(e),e},rX.createPortal=function(e,n,t){var r=3=c&&o>=f&&a<=d&&l<=p){e.splice(n,1);break}if(r!==c||t.width!==u.width||pl){if(!(o!==f||t.height!==u.height||da)){c>r&&(u.width+=c-r,u.x=r),do&&(u.height+=f-o,u.y=o),pt&&(t=s)),s ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},rX.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return ad(e.child.stateNode);default:return e.child.stateNode}},rX.injectIntoDevTools=function(){var e={bundleType:0,version:as,rendererPackageName:au,currentDispatcherRef:ai,findFiberByHostInstance:aA,reconcilerVersion:"19.0.0"};if(null!==ac&&(e.rendererConfig=ac),"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)e=!1;else{var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled||!n.supportsFiber)e=!0;else{try{oc=n.inject(e),od=n}catch(e){}e=!!n.checkDCE}}return e},rX.isAlreadyRendering=function(){return!1},rX.observeVisibleRects=function(e,n,t,r){if(!aX)throw Error(i(363));var a=aZ(e=t9(e,n),t,r).disconnect;return{disconnect:function(){a()}}},rX.shouldError=function(){return null},rX.shouldSuspend=function(){return!1},rX.startHostTransition=function(e,n,t,r){if(5!==e.tag)throw Error(i(476));var o=nE(e).queue;nS(e,o,n,ak,null===t?a:function(){var n=nE(e).next.queue;return ny(e,n,{},t7()),t(r)})},rX.updateContainer=function(e,n,t,r){var a=n.current,i=t7();return rV(a,i,e,n,t,r),i},rX.updateContainerSync=function(e,n,t,r){return 0===n.tag&&rb(),rV(n.current,2,e,n,t,r),2},rX},n.exports.default=n.exports,Object.defineProperty(n.exports,"__esModule",{value:!0})},98133,(e,n,t)=>{"use strict";n.exports=e.r(40336)},45015,(e,n,t)=>{"use strict";function r(e,n){var t=e.length;for(e.push(n);0>>1,a=e[r];if(0>>1;ro(s,t))uo(c,s)?(e[r]=c,e[u]=t,r=u):(e[r]=s,e[l]=t,r=l);else if(uo(c,t))e[r]=c,e[u]=t,r=u;else break}}return n}function o(e,n){var t=e.sortIndex-n.sortIndex;return 0!==t?t:e.id-n.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,_=!1,v=!1,S="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,T="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var n=a(f);null!==n;){if(null===n.callback)i(f);else if(n.startTime<=e)i(f),n.sortIndex=n.expirationTime,r(d,n);else break;n=a(f)}}function M(e){if(v=!1,b(e),!_)if(null!==a(d))_=!0,U();else{var n=a(f);null!==n&&D(M,n.startTime-e)}}var x=!1,R=-1,C=5,y=-1;function A(){return!(t.unstable_now()-ye&&A());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof s){m.callback=s,b(e),n=!0;break n}m===a(d)&&i(d),b(e)}else i(d);m=a(d)}if(null!==m)n=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),n=!1}}break e}finally{m=null,h=r,g=!1}}}finally{n?l():x=!1}}}if("function"==typeof T)l=function(){T(P)};else if("undefined"!=typeof MessageChannel){var w=new MessageChannel,L=w.port2;w.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){S(P,0)};function U(){x||(x=!0,l())}function D(e,n){R=S(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||g||(_=!0,U())},t.unstable_forceFrameRate=function(e){0>e||125o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(v?(E(R),R=-1):v=!0,D(M,i-o))):(e.sortIndex=l,r(d,e),_||g||(_=!0,U())),e},t.unstable_shouldYield=A,t.unstable_wrapCallback=function(e){var n=h;return function(){var t=h;h=n;try{return e.apply(this,arguments)}finally{h=t}}}},95087,(e,n,t)=>{"use strict";n.exports=e.r(45015)},91037,8560,8155,66748,46791,e=>{"use strict";let n,t,r,a,i,o,l,s,u;var c,d,f,p=e.i(71645),m=e.i(39695),h=e.i(90072),g=h;function _(){let e=null,n=!1,t=null,r=null;function a(n,i){t(n,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===n||null!==t&&(r=e.requestAnimationFrame(a),n=!0)},stop:function(){e.cancelAnimationFrame(r),n=!1},setAnimationLoop:function(e){t=e},setContext:function(n){e=n}}}function v(e){let n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){let e=n.get(t);(!e||e.versione.start-n.start);let n=0;for(let e=1;e 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},E={common:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new g.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new g.Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new g.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new g.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new g.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new g.Matrix3},normalScale:{value:new g.Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new g.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new g.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new g.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new g.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new g.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0},uvTransform:{value:new g.Matrix3}},sprite:{diffuse:{value:new g.Color(0xffffff)},opacity:{value:1},center:{value:new g.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new g.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new g.Matrix3},alphaTest:{value:0}}},T={basic:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.fog]),vertexShader:S.meshbasic_vert,fragmentShader:S.meshbasic_frag},lambert:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshlambert_vert,fragmentShader:S.meshlambert_frag},phong:{uniforms:(0,g.mergeUniforms)([E.common,E.specularmap,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},specular:{value:new g.Color(1118481)},shininess:{value:30}}]),vertexShader:S.meshphong_vert,fragmentShader:S.meshphong_frag},standard:{uniforms:(0,g.mergeUniforms)([E.common,E.envmap,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.roughnessmap,E.metalnessmap,E.fog,E.lights,{emissive:{value:new g.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag},toon:{uniforms:(0,g.mergeUniforms)([E.common,E.aomap,E.lightmap,E.emissivemap,E.bumpmap,E.normalmap,E.displacementmap,E.gradientmap,E.fog,E.lights,{emissive:{value:new g.Color(0)}}]),vertexShader:S.meshtoon_vert,fragmentShader:S.meshtoon_frag},matcap:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,E.fog,{matcap:{value:null}}]),vertexShader:S.meshmatcap_vert,fragmentShader:S.meshmatcap_frag},points:{uniforms:(0,g.mergeUniforms)([E.points,E.fog]),vertexShader:S.points_vert,fragmentShader:S.points_frag},dashed:{uniforms:(0,g.mergeUniforms)([E.common,E.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:S.linedashed_vert,fragmentShader:S.linedashed_frag},depth:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap]),vertexShader:S.depth_vert,fragmentShader:S.depth_frag},normal:{uniforms:(0,g.mergeUniforms)([E.common,E.bumpmap,E.normalmap,E.displacementmap,{opacity:{value:1}}]),vertexShader:S.meshnormal_vert,fragmentShader:S.meshnormal_frag},sprite:{uniforms:(0,g.mergeUniforms)([E.sprite,E.fog]),vertexShader:S.sprite_vert,fragmentShader:S.sprite_frag},background:{uniforms:{uvTransform:{value:new g.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:S.background_vert,fragmentShader:S.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new g.Matrix3}},vertexShader:S.backgroundCube_vert,fragmentShader:S.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:S.cube_vert,fragmentShader:S.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:S.equirect_vert,fragmentShader:S.equirect_frag},distance:{uniforms:(0,g.mergeUniforms)([E.common,E.displacementmap,{referencePosition:{value:new g.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:S.distance_vert,fragmentShader:S.distance_frag},shadow:{uniforms:(0,g.mergeUniforms)([E.lights,E.fog,{color:{value:new g.Color(0)},opacity:{value:1}}]),vertexShader:S.shadow_vert,fragmentShader:S.shadow_frag}};T.physical={uniforms:(0,g.mergeUniforms)([T.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new g.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new g.Matrix3},clearcoatNormalScale:{value:new g.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new g.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new g.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new g.Matrix3},sheen:{value:0},sheenColor:{value:new g.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new g.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new g.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new g.Matrix3},transmissionSamplerSize:{value:new g.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new g.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new g.Color(0)},specularColor:{value:new g.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new g.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new g.Matrix3},anisotropyVector:{value:new g.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new g.Matrix3}}]),vertexShader:S.meshphysical_vert,fragmentShader:S.meshphysical_frag};let b={r:0,b:0,g:0},M=new g.Euler,x=new g.Matrix4;function R(e,n,t,r,a,i,o){let l,s,u=new g.Color(0),c=+(!0!==i),d=null,f=0,p=null;function m(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?t:n).get(r)),r}function h(n,t){n.getRGB(b,(0,g.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(b.r,b.g,b.b,t,o)}return{getClearColor:function(){return u},setClearColor:function(e,n=1){u.set(e),h(u,c=n)},getClearAlpha:function(){return c},setClearAlpha:function(e){h(u,c=e)},render:function(n){let t=!1,a=m(n);null===a?h(u,c):a&&a.isColor&&(h(a,1),t=!0);let i=e.xr.getEnvironmentBlendMode();"additive"===i?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===i&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||t)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,t){let r=m(t);r&&(r.isCubeTexture||r.mapping===g.CubeUVReflectionMapping)?(void 0===s&&((s=new g.Mesh(new g.BoxGeometry(1,1,1),new g.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,g.cloneUniforms)(T.backgroundCube.uniforms),vertexShader:T.backgroundCube.vertexShader,fragmentShader:T.backgroundCube.fragmentShader,side:g.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,n,t){this.matrixWorld.copyPosition(t.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(s)),M.copy(t.backgroundRotation),M.x*=-1,M.y*=-1,M.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(M.y*=-1,M.z*=-1),s.material.uniforms.envMap.value=r,s.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,s.material.uniforms.backgroundBlurriness.value=t.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(x.makeRotationFromEuler(M)),s.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,(d!==r||f!==r.version||p!==e.toneMapping)&&(s.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):r&&r.isTexture&&(void 0===l&&((l=new g.Mesh(new g.PlaneGeometry(2,2),new g.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,g.cloneUniforms)(T.background.uniforms),vertexShader:T.background.vertexShader,fragmentShader:T.background.fragmentShader,side:g.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=t.backgroundIntensity,l.material.toneMapped=g.ColorManagement.getTransfer(r.colorSpace)!==g.SRGBTransfer,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function C(e,n){let t=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(n){return e.bindVertexArray(n)}function s(n){return e.deleteVertexArray(n)}function u(e){let n=[],r=[],a=[];for(let e=0;e=0){let t=a[n],r=o[n];if(void 0===r&&("instanceMatrix"===n&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(r=e.instanceColor)),void 0===t||t.attribute!==r||r&&t.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(t,h,s,_))&&function(e,n,t,r){let a={},o=n.attributes,l=0,s=t.getAttributes();for(let n in s)if(s[n].location>=0){let t=o[n];void 0===t&&("instanceMatrix"===n&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===n&&e.instanceColor&&(t=e.instanceColor));let r={};r.attribute=t,t&&t.data&&(r.data=t.data),a[n]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(t,h,s,_),null!==_&&n.update(_,e.ELEMENT_ARRAY_BUFFER),(x||o)&&(o=!1,function(t,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&t.instanceMatrix&&(l=t.instanceMatrix),"instanceColor"===r&&t.instanceColor&&(l=t.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=n.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===g.IntType;if(l.isInterleavedBufferAttribute){let n=l.data,s=n.stride,g=l.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";n="mediump"}return"mediump"===n&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==t.precision?t.precision:"highp",l=i(o);return l!==o&&((0,g.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(n){return n===g.RGBAFormat||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(t){let a=t===g.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return t===g.UnsignedByteType||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||t===g.FloatType||!!a},precision:o,logarithmicDepthBuffer:!0===t.logarithmicDepthBuffer,reversedDepthBuffer:!0===t.reversedDepthBuffer&&n.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function P(e){let n=this,t=null,r=0,a=!1,i=!1,o=new g.Plane,l=new g.Matrix3,s={value:null,needsUpdate:!1};function u(e,t,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let n=r+4*i,a=t.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length0),n.numPlanes=r,n.numIntersection=0)}}function w(e){let n=new WeakMap;function t(e,n){return n===g.EquirectangularReflectionMapping?e.mapping=g.CubeReflectionMapping:n===g.EquirectangularRefractionMapping&&(e.mapping=g.CubeRefractionMapping),e}function r(e){let t=e.target;t.removeEventListener("dispose",r);let a=n.get(t);void 0!==a&&(n.delete(t),a.dispose())}return{get:function(a){if(a&&a.isTexture){let i=a.mapping;if(i===g.EquirectangularReflectionMapping||i===g.EquirectangularRefractionMapping)if(n.has(a))return t(n.get(a).texture,a.mapping);else{let i=a.image;if(!i||!(i.height>0))return null;{let o=new g.WebGLCubeRenderTarget(i.height);return o.fromEquirectangularTexture(e,a),n.set(a,o),a.addEventListener("dispose",r),t(o.texture,a.mapping)}}}return a},dispose:function(){n=new WeakMap}}}let L=[.125,.215,.35,.446,.526,.582],U=new g.OrthographicCamera,D=new g.Color,N=null,I=0,F=0,O=!1,B=new g.Vector3;class G{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,t=.1,r=100,a={}){let{size:i=256,position:o=B}=a;N=this._renderer.getRenderTarget(),I=this._renderer.getActiveCubeFace(),F=this._renderer.getActiveMipmapLevel(),O=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,t,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=z(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=V(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?l=L[o-e+4-1]:0===o&&(l=0),t.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let n=e%3*2/3-1,t=e>2?0:-1,r=[n,t,0,n+2/3,t,0,n+2/3,t+1,0,n,t,0,n+2/3,t+1,0,n,t+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new g.BufferGeometry;h.setAttribute("position",new g.BufferAttribute(f,3)),h.setAttribute("uv",new g.BufferAttribute(p,2)),h.setAttribute("faceIndex",new g.BufferAttribute(m,1)),r.push(new g.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:n,sigmas:t}}(d)),this._blurMaterial=(a=d,i=e,o=n,r=new Float32Array(20),c=new g.Vector3(0,1,0),new g.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:W(),fragmentShader:` precision mediump float; precision mediump int; @@ -348,4 +348,4 @@ void main() { } -}`;class nz{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let t=new g.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=t}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,t=new g.ShaderMaterial({vertexShader:nH,fragmentShader:nV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new g.Mesh(new g.PlaneGeometry(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nW extends g.EventDispatcher{constructor(e,n){super();const t=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="undefined"!=typeof XRWebGLBinding,h=new nz,v={},S=n.getContextAttributes();let E=null,T=null;const b=[],M=[],x=new g.Vector2;let R=null;const C=new g.PerspectiveCamera;C.viewport=new g.Vector4;const y=new g.PerspectiveCamera;y.viewport=new g.Vector4;const A=[C,y],P=new g.ArrayCamera;let w=null,L=null;function U(e){let n=M.indexOf(e.inputSource);if(-1===n)return;let t=b[n];void 0!==t&&(t.update(e.inputSource,e.frame,s||i),t.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",N);for(let e=0;e=0&&(M[r]=null,b[r].disconnect(t))}for(let n=0;n=M.length){M.push(t),r=e;break}else if(null===M[e]){M[e]=t,r=e;break}if(-1===r)break}let a=b[r];a&&a.connect(t)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getGripSpace()},this.getHand=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,n)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(E=e.getRenderTarget(),r.addEventListener("select",U),r.addEventListener("selectstart",U),r.addEventListener("selectend",U),r.addEventListener("squeeze",U),r.addEventListener("squeezestart",U),r.addEventListener("squeezeend",U),r.addEventListener("end",D),r.addEventListener("inputsourceschange",N),!0!==S.xrCompatible&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(x),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,o=null;S.depth&&(o=S.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=S.stencil?g.DepthStencilFormat:g.DepthFormat,i=S.stencil?g.UnsignedInt248Type:g.UnsignedIntType);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new g.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,depthTexture:new g.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:4*!!S.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let t={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,n,t),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),T=new g.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new g.Vector3,F=new g.Vector3;function O(e,n){null===n?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(n.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,t,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),P.near=y.near=C.near=i,P.far=y.far=C.far=o,(w!==P.near||L!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),w=P.near,L=P.far),P.layers.mask=6|e.layers.mask,C.layers.mask=3&P.layers.mask,y.layers.mask=5&P.layers.mask;let l=e.parent,s=P.cameras;O(P,l);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let a=n.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,nX.copy(o),nX.x*=-1,nX.y*=-1,nX.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(nX.y*=-1,nX.z*=-1),e.envMapRotation.value.setFromMatrix4(nj.makeRotationFromEuler(nX)),e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,t(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,t(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,t){t.color.getRGB(n.fogColor.value,(0,g.getUnlitUniformColorSpace)(e)),t.isFog?(n.fogNear.value=t.near,n.fogFar.value=t.far):t.isFogExp2&&(n.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,_,v,S,E,T,b,M,x,R,C,y,A,P,w,L;let U;a.isMeshBasicMaterial||a.isMeshLambertMaterial?r(e,a):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,_=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===g.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),v=e,(S=a).matcap&&(v.matcap.value=S.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),E=e,T=a,U=n.get(T).light,E.referencePosition.value.setFromMatrixPosition(U.matrixWorld),E.nearDistance.value=U.shadow.camera.near,E.farDistance.value=U.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(b=e,M=a,b.diffuse.value.copy(M.color),b.opacity.value=M.opacity,M.map&&(b.map.value=M.map,t(M.map,b.mapTransform)),a.isLineDashedMaterial&&(x=e,R=a,x.dashSize.value=R.dashSize,x.totalSize.value=R.dashSize+R.gapSize,x.scale.value=R.scale)):a.isPointsMaterial?(C=e,y=a,A=i,P=o,C.diffuse.value.copy(y.color),C.opacity.value=y.opacity,C.size.value=y.size*A,C.scale.value=.5*P,y.map&&(C.map.value=y.map,t(y.map,C.uvTransform)),y.alphaMap&&(C.alphaMap.value=y.alphaMap,t(y.alphaMap,C.alphaMapTransform)),y.alphaTest>0&&(C.alphaTest.value=y.alphaTest)):a.isSpriteMaterial?(w=e,L=a,w.diffuse.value.copy(L.color),w.opacity.value=L.opacity,w.rotation.value=L.rotation,L.map&&(w.map.value=L.map,t(L.map,w.mapTransform)),L.alphaMap&&(w.alphaMap.value=L.alphaMap,t(L.alphaMap,w.alphaMapTransform)),L.alphaTest>0&&(w.alphaTest.value=L.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function nY(e,n,t,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,g.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,g.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function u(n){let t=n.target;t.removeEventListener("dispose",u);let r=o.indexOf(t.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[t.id]),delete a[t.id],delete i[t.id]}return{bind:function(e,n){let t=n.program;r.uniformBlockBinding(e,t)},update:function(t,c){var d;let f,p,m,h,_=a[t.id];void 0===_&&(function(e){let n=e.uniforms,t=0;for(let e=0,r=n.length;e0&&(t+=16-r),e.__size=t,e.__cache={}}(t),(d=t).__bindingPointIndex=f=function(){for(let e=0;ep.matrixWorld.determinant(),S=function(e,n,t,i,c){var d,f;!0!==n.isScene&&(n=eF),l.resetTextureUnits();let p=n.fog,h=i.isMeshStandardMaterial?n.environment:null,_=null===em?ec.outputColorSpace:!0===em.isXRRenderTarget?em.texture.colorSpace:g.LinearSRGBColorSpace,v=(i.isMeshStandardMaterial?u:s).get(i.envMap||h),S=!0===i.vertexColors&&!!t.attributes.color&&4===t.attributes.color.itemSize,T=!!t.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),b=!!t.morphAttributes.position,x=!!t.morphAttributes.normal,R=!!t.morphAttributes.color,C=g.NoToneMapping;i.toneMapped&&(null===em||!0===em.isXRRenderTarget)&&(C=ec.toneMapping);let y=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,A=void 0!==y?y.length:0,P=o.get(i),w=eo.state.lights;if(!0===eL&&(!0===eU||e!==eg)){let n=e===eg&&i.id===eh;E.setState(i,e,n)}let L=!1;i.version===P.__version?P.needsLights&&P.lightsStateVersion!==w.state.version||P.outputColorSpace!==_||c.isBatchedMesh&&!1===P.batching?L=!0:c.isBatchedMesh||!0!==P.batching?c.isBatchedMesh&&!0===P.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===P.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===P.instancing?L=!0:c.isInstancedMesh||!0!==P.instancing?c.isSkinnedMesh&&!1===P.skinning?L=!0:c.isSkinnedMesh||!0!==P.skinning?c.isInstancedMesh&&!0===P.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===P.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===P.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===P.instancingMorph&&null!==c.morphTexture||P.envMap!==v||!0===i.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==E.numPlanes||P.numIntersection!==E.numIntersection)||P.vertexAlphas!==S||P.vertexTangents!==T||P.morphTargets!==b||P.morphNormals!==x||P.morphColors!==R||P.toneMapping!==C?L=!0:P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=i.version);let U=P.currentProgram;!0===L&&(U=e4(i,n,c));let D=!1,I=!1,F=!1,O=U.getUniforms(),B=P.uniforms;if(a.useProgram(U.program)&&(D=!0,I=!0,F=!0),i.id!==eh&&(eh=i.id,I=!0),D||eg!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eG,"projectionMatrix",e.projectionMatrix),O.setValue(eG,"viewMatrix",e.matrixWorldInverse);let n=O.map.cameraPosition;void 0!==n&&n.setValue(eG,eN.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eG,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&O.setValue(eG,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,I=!0,F=!0)}if(P.needsLights&&(w.state.directionalShadowMap.length>0&&O.setValue(eG,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&O.setValue(eG,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&O.setValue(eG,"pointShadowMap",w.state.pointShadowMap,l)),c.isSkinnedMesh){O.setOptional(eG,c,"bindMatrix"),O.setOptional(eG,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eG,"boneTexture",e.boneTexture,l))}c.isBatchedMesh&&(O.setOptional(eG,c,"batchingTexture"),O.setValue(eG,"batchingTexture",c._matricesTexture,l),O.setOptional(eG,c,"batchingIdTexture"),O.setValue(eG,"batchingIdTexture",c._indirectTexture,l),O.setOptional(eG,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eG,"batchingColorTexture",c._colorsTexture,l));let G=t.morphAttributes;if((void 0!==G.position||void 0!==G.normal||void 0!==G.color)&&M.update(c,t,U),(I||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,O.setValue(eG,"receiveShadow",c.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=v,B.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==n.environment&&(B.envMapIntensity.value=n.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===n$&&((n$=new g.DataTexture(nK,16,16,g.RGFormat,g.HalfFloatType)).name="DFG_LUT",n$.minFilter=g.LinearFilter,n$.magFilter=g.LinearFilter,n$.wrapS=g.ClampToEdgeWrapping,n$.wrapT=g.ClampToEdgeWrapping,n$.generateMipmaps=!1,n$.needsUpdate=!0),n$)),I&&(O.setValue(eG,"toneMappingExposure",ec.toneMappingExposure),P.needsLights&&(d=B,f=F,d.ambientLightColor.needsUpdate=f,d.lightProbe.needsUpdate=f,d.directionalLights.needsUpdate=f,d.directionalLightShadows.needsUpdate=f,d.pointLights.needsUpdate=f,d.pointLightShadows.needsUpdate=f,d.spotLights.needsUpdate=f,d.spotLightShadows.needsUpdate=f,d.rectAreaLights.needsUpdate=f,d.hemisphereLights.needsUpdate=f),p&&!0===i.fog&&m.refreshFogUniforms(B,p),m.refreshMaterialUniforms(B,i,ex,eM,eo.state.transmissionRenderTarget[e.id]),e2.upload(eG,e5(P),B,l)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e2.upload(eG,e5(P),B,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(eG,"center",c.center),O.setValue(eG,"modelViewMatrix",c.modelViewMatrix),O.setValue(eG,"normalMatrix",c.normalMatrix),O.setValue(eG,"modelMatrix",c.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){let e=i.uniformsGroups;for(let n=0,t=e.length;n{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?n(e):setTimeout(r,10)}null!==t.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eK(){eQ.stop()}function e$(){eQ.start()}const eQ=new _;function eZ(e,n,t,r){if(!1===e.visible)return;if(e.layers.test(n.layers)){if(e.isGroup)t=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)eo.pushLight(e),e.castShadow&&eo.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ew.intersectsSprite(e)){r&&eI.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eD);let n=f.update(e),a=e.material;a.visible&&ei.push(e,n,a,t,eI.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ew.intersectsObject(e))){let n=f.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eI.copy(e.boundingSphere.center)):(null===n.boundingSphere&&n.computeBoundingSphere(),eI.copy(n.boundingSphere.center)),eI.applyMatrix4(e.matrixWorld).applyMatrix4(eD)),Array.isArray(a)){let r=n.groups;for(let i=0,o=r.length;i0&&e1(i,n,t),o.length>0&&e1(o,n,t),l.length>0&&e1(l,n,t),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e0(e,n,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===eo.state.transmissionRenderTarget[i.id]){let e=t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float");eo.state.transmissionRenderTarget[i.id]=new g.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?g.HalfFloatType:g.UnsignedByteType,minFilter:g.LinearMipmapLinearFilter,samples:r.samples,stencilBuffer:B,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:g.ColorManagement.workingColorSpace})}let o=eo.state.transmissionRenderTarget[i.id],s=i.viewport||e_;o.setSize(s.z*ec.transmissionResolutionScale,s.w*ec.transmissionResolutionScale);let u=ec.getRenderTarget(),c=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(eE),(eT=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eO&&b.render(a);let f=ec.toneMapping;ec.toneMapping=g.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),eo.setupLightsView(i),!0===eL&&E.setGlobalState(ec.clippingPlanes,i),e1(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===t.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let t=0,r=n.length;t0)for(let n=0,i=a.length;n0&&e0(t,r,e,n),eO&&b.render(e),eJ(ei,e,n)}null!==em&&0===ep&&(l.updateMultisampleRenderTarget(em),l.updateRenderTargetMipmap(em)),r&&eu.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,n),D.resetDefaultState(),eh=-1,eg=null,es.pop(),es.length>0?(eo=es[es.length-1],!0===eL&&E.setGlobalState(ec.clippingPlanes,eo.state.camera)):eo=null,el.pop(),ei=el.length>0?el[el.length-1]:null},this.getActiveCubeFace=function(){return ef},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return em},this.setRenderTargetTextures=function(e,n,t){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=n,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:t,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,n){let t=o.get(e);t.__webglFramebuffer=n,t.__useDefaultFramebuffer=void 0===n};const e8=eG.createFramebuffer();this.setRenderTarget=function(e,n=0,t=0){em=e,ef=n,ep=t;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eG.FRAMEBUFFER,u.__webglFramebuffer),e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest,a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),eh=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let n=e.depthTexture;if(u.__boundDepthTexture!==n){if(null!==n&&o.has(n)&&(e.width!==n.image.width||e.height!==n.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(d[n])?d[n][t]:d[n],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[t]:d,e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest}else e_.copy(ey).multiplyScalar(ex).floor(),ev.copy(eA).multiplyScalar(ex).floor(),eS=eP;if(0!==t&&(r=e8),a.bindFramebuffer(eG.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),i){let r=o.get(e.texture);eG.framebufferTexture2D(eG.FRAMEBUFFER,eG.COLOR_ATTACHMENT0,eG.TEXTURE_CUBE_MAP_POSITIVE_X+n,r.__webglTexture,t)}else if(s)for(let r=0;r=0&&n<=e.width-i&&t>=0&&t<=e.height-l&&(e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(o),U.convert(u),s))}finally{let e=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,t,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(n>=0&&n<=e.width-i&&t>=0&&t<=e.height-l){a.bindFramebuffer(eG.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eG.createBuffer();eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.bufferData(eG.PIXEL_PACK_BUFFER,s.byteLength,eG.STREAM_READ),e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(f),U.convert(p),0);let h=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,h);let _=eG.fenceSync(eG.SYNC_GPU_COMMANDS_COMPLETE,0);return eG.flush(),await (0,g.probeAsync)(eG,_,4),eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.getBufferSubData(eG.PIXEL_PACK_BUFFER,0,s),eG.deleteBuffer(m),eG.deleteSync(_),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,n=null,t=0){let r=Math.pow(2,-t),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==n?n.x:0,u=null!==n?n.y:0;l.setTexture2D(e,0),eG.copyTexSubImage2D(eG.TEXTURE_2D,t,0,0,s,u,i,o),a.unbindTexture()};const e9=eG.createFramebuffer(),e7=eG.createFramebuffer();this.copyTextureToTexture=function(e,n,t=null,r=null,i=0,s=null){let u,c,d,f,p,m,h,_,v,S;null===s&&(0!==i?((0,g.warnOnce)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);let E=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==t)u=t.max.x-t.min.x,c=t.max.y-t.min.y,d=t.isBox3?t.max.z-t.min.z:1,f=t.min.x,p=t.min.y,m=t.isBox3?t.min.z:0;else{let n=Math.pow(2,-i);u=Math.floor(E.width*n),c=Math.floor(E.height*n),d=e.isDataArrayTexture?E.depth:e.isData3DTexture?Math.floor(E.depth*n):1,f=0,p=0,m=0}null!==r?(h=r.x,_=r.y,v=r.z):(h=0,_=0,v=0);let T=U.convert(n.format),b=U.convert(n.type);n.isData3DTexture?(l.setTexture3D(n,0),S=eG.TEXTURE_3D):n.isDataArrayTexture||n.isCompressedArrayTexture?(l.setTexture2DArray(n,0),S=eG.TEXTURE_2D_ARRAY):(l.setTexture2D(n,0),S=eG.TEXTURE_2D),eG.pixelStorei(eG.UNPACK_FLIP_Y_WEBGL,n.flipY),eG.pixelStorei(eG.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eG.pixelStorei(eG.UNPACK_ALIGNMENT,n.unpackAlignment);let M=eG.getParameter(eG.UNPACK_ROW_LENGTH),x=eG.getParameter(eG.UNPACK_IMAGE_HEIGHT),R=eG.getParameter(eG.UNPACK_SKIP_PIXELS),C=eG.getParameter(eG.UNPACK_SKIP_ROWS),y=eG.getParameter(eG.UNPACK_SKIP_IMAGES);eG.pixelStorei(eG.UNPACK_ROW_LENGTH,E.width),eG.pixelStorei(eG.UNPACK_IMAGE_HEIGHT,E.height),eG.pixelStorei(eG.UNPACK_SKIP_PIXELS,f),eG.pixelStorei(eG.UNPACK_SKIP_ROWS,p),eG.pixelStorei(eG.UNPACK_SKIP_IMAGES,m);let A=e.isDataArrayTexture||e.isData3DTexture,P=n.isDataArrayTexture||n.isData3DTexture;if(e.isDepthTexture){let t=o.get(e),r=o.get(n),l=o.get(t.__renderTarget),g=o.get(r.__renderTarget);a.bindFramebuffer(eG.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eG.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let t=0;tG,"ShaderChunk",()=>S,"ShaderLib",()=>T,"UniformsLib",()=>E,"WebGLRenderer",()=>nQ,"WebGLUtils",()=>nk],8560);var nZ=e.i(30224);let nJ=e=>{let n,t=new Set,r=(e,r)=>{let a="function"==typeof e?e(n):e;if(!Object.is(a,n)){let e=n;n=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},n,a),t.forEach(t=>t(n,e))}},a=()=>n,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(t.add(e),()=>t.delete(e))},o=n=e(r,a,i);return i},n0=e=>e?nJ(e):nJ;e.s(["createStore",()=>n0],8155);let{useSyncExternalStoreWithSelector:n1}=nZ.default,n3=(e,n)=>{let t=n0(e),r=(e,r=n)=>(function(e,n=e=>e,t){let r=n1(e.subscribe,e.getState,e.getInitialState,n,t);return p.default.useDebugValue(r),r})(t,e,r);return Object.assign(r,t),r},n2=[];function n4(e,n,t=(e,n)=>e===n){if(e===n)return!0;if(!e||!n)return!1;let r=e.length;if(n.length!==r)return!1;for(let a=0;a0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}let a={keys:n,equal:r.equal,remove:()=>{let e=n2.indexOf(a);-1!==e&&n2.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...n)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(n2.push(a),!t)throw a.promise}var n6=e.i(98133),n8=e.i(95087),n9=e.i(43476),n7=p;function te(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=te(r,n,t);if(e)return e;r=n?null:r.sibling}}function tn(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(n){return e}}"undefined"!=typeof window&&((null==(c=window.document)?void 0:c.createElement)||(null==(d=window.navigator)?void 0:d.product)==="ReactNative")?n7.useLayoutEffect:n7.useEffect;let tt=tn(n7.createContext(null));class tr extends n7.Component{render(){return n7.createElement(tt.Provider,{value:this._reactInternals},this.props.children)}}function ta(){let e=n7.useContext(tt);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=n7.useId();return n7.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=te(t,!1,e=>{let t=e.memoizedState;for(;t;){if(t.memoizedState===n)return!0;t=t.next}});if(e)return e}},[e,n])}let ti=Symbol.for("react.context"),to=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ti;function tl(){let e=function(){let e=ta(),[n]=n7.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;to(e)&&e!==tt&&!n.has(e)&&n.set(e,n7.use(tn(e))),t=t.return}return n}();return n7.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>n7.createElement(n,null,n7.createElement(t.Provider,{...r,value:e.get(t)})),e=>n7.createElement(tr,{...e})),[e])}function ts(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>tr,"traverseFiber",()=>te,"useContextBridge",()=>tl,"useFiber",()=>ta],46791),p.act;let tu=e=>e&&e.hasOwnProperty("current"),tc=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),td="undefined"!=typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?p.useLayoutEffect:p.useEffect;function tf(e){let n=p.useRef(e);return td(()=>void(n.current=e),[e]),n}function tp(){let e=ta(),n=tl();return p.useMemo(()=>({children:t})=>{let r=te(e,!0,e=>e.type===p.StrictMode)?p.StrictMode:p.Fragment;return(0,n9.jsx)(r,{children:(0,n9.jsx)(n,{children:t})})},[e,n])}function tm({set:e}){return td(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let th=((s=class extends p.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function tg(e){var n;let t="undefined"!=typeof window?null!=(n=window.devicePixelRatio)?n:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function t_(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tv={obj:e=>e===Object(e)&&!tv.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,n,{arrays:t="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof n||!!e!=!!n)return!1;if(tv.str(e)||tv.num(e)||tv.boo(e))return e===n;let o=tv.obj(e);if(o&&"reference"===r)return e===n;let l=tv.arr(e);if(l&&"reference"===t)return e===n;if((l||o)&&e===n)return!0;for(i in e)if(!(i in n))return!1;if(o&&"shallow"===t&&"shallow"===r){for(i in a?n:e)if(!tv.equ(e[i],n[i],{strict:a,objects:"reference"}))return!1}else for(i in a?n:e)if(e[i]!==n[i])return!1;if(tv.und(i)){if(l&&0===e.length&&0===n.length||o&&0===Object.keys(e).length&&0===Object.keys(n).length)return!0;if(e!==n)return!1}return!0}},tS=["children","key","ref"];function tE(e,n,t,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:n,type:t,parent:null,children:[],props:function(e){let n={};for(let t in e)tS.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tT(e,n){if(!n.includes("-")||n in e)return{root:e,key:n,target:e[n]};let t=e,r=n.split("-");for(let a of r){if("object"!=typeof t||null===t){if(void 0!==t)return{root:t,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:n,target:void 0}}n=a,e=t,t=t[n]}return{root:e,key:n,target:t}}let tb=/-\d+$/;function tM(e,n){if(tv.str(n.props.attach)){if(tb.test(n.props.attach)){let t=n.props.attach.replace(tb,""),{root:r,key:a}=tT(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tT(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tv.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function tx(e,n){if(tv.str(n.props.attach)){let{root:t,key:r}=tT(e.object,n.props.attach),a=n.previousAttach;void 0===a?delete t[r]:t[r]=a}else null==n.previousAttach||n.previousAttach(e.object,n.object);delete n.previousAttach}let tR=[...tS,"args","dispose","attach","object","onUpdate","dispose"],tC=new Map,ty=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tA=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tP(e,n){var t,r;let a=e.__r3f,i=a&&ts(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tR.includes(t))continue;if(a&&tA.test(t)){"function"==typeof o?a.handlers[t]=o:delete a.handlers[t],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;let{root:l,key:s,target:u}=tT(e,t);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${t}". Ensure it is an object before setting "${s}".`);u instanceof h.Layers&&o instanceof h.Layers?u.mask=o.mask:u instanceof h.Color&&tc(o)?u.set(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor?u.copy(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o)?"function"==typeof u.fromArray?u.fromArray(o):u.set(...o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o?"function"==typeof u.setScalar?u.setScalar(o):u.set(o):(l[s]=o,i&&!i.linear&&ty.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===h.RGBAFormat&&l[s].type===h.UnsignedByteType&&(l[s].colorSpace=h.SRGBColorSpace))}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(t=a.object)&&t.isObject3D&&o!==a.eventCount){let e=a.object,n=i.internal.interaction.indexOf(e);n>-1&&i.internal.interaction.splice(n,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&tw(a),e}function tw(e){var n;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let t=null==(n=e.root)||null==n.getState?void 0:n.getState();t&&0===t.internal.frames&&t.invalidate()}let tL=e=>null==e?void 0:e.isObject3D;function tU(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tD(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tN=e=>!!(null!=e&&e.render),tI=p.createContext(null);function tF(){let e=p.useContext(tI);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tO(e=e=>e,n){return tF()(e,n)}function tB(e,n=0){let t=tF(),r=t.getState().internal.subscribe,a=tf(e);return td(()=>r(a,n,t),[n,r,t]),null}let tG=new WeakMap;function tk(e,n){return function(t,...r){var a;let i;return"function"==typeof t&&(null==t||null==(a=t.prototype)?void 0:a.constructor)===t?(i=tG.get(t))||(i=new t,tG.set(t,i)):i=t,e&&e(i),Promise.all(r.map(e=>new Promise((t,r)=>i.load(e,e=>{var n;let r;tL(null==e?void 0:e.scene)&&Object.assign(e,(n=e.scene,r={nodes:{},materials:{},meshes:{}},n&&n.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),t(e)},n,n=>r(Error(`Could not load ${e}: ${null==n?void 0:n.message}`))))))}}function tH(e,n,t,r){let a=Array.isArray(n)?n:[n],i=n5(tk(t,r),[e,...a],!1,{equal:tv.equ});return Array.isArray(n)?i:i[0]}tH.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];n5(tk(t),[e,...a],!0,r)},tH.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n2.splice(0,n2.length);else{let e=n2.find(e=>n4(t,e.keys,e.equal));e&&e.remove()}};let tV={},tz=/^three(?=[A-Z])/,tW=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tX=0;function tj(e){if("function"==typeof e){let n=`${tX++}`;return tV[n]=e,n}Object.assign(tV,e)}function tq(e,n){let t=tW(e),r=tV[t];if("primitive"!==e&&!r)throw Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!n.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==n.args&&!Array.isArray(n.args))throw Error("R3F: The args prop must be an array!")}function tY(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tM(e.parent,e):tL(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tw(e)}}function tK(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=tV[tW(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tP(n.object,n.props),n.props.attach)tM(e,n);else if(tL(n.object)&&tL(e.object)){let r=e.object.children.indexOf(null==t?void 0:t.object);if(t&&-1!==r){let t=e.object.children.indexOf(n.object);-1!==t?(e.object.children.splice(t,1),e.object.children.splice(t{try{e.dispose()}catch{}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?n():(0,n8.unstable_scheduleCallback)(n8.unstable_IdlePriority,n)}}function tJ(e,n,t){if(!n)return;n.parent=null;let r=e.children.indexOf(n);-1!==r&&e.children.splice(r,1),n.props.attach?tx(e,n):tL(n.object)&&tL(e.object)&&(e.object.remove(n.object),function(e,n){let{internal:t}=e.getState();t.interaction=t.interaction.filter(e=>e!==n),t.initialHits=t.initialHits.filter(e=>e!==n),t.hovered.forEach((e,r)=>{(e.eventObject===n||e.object===n)&&t.hovered.delete(r)}),t.capturedMap.forEach((e,r)=>{tD(t.capturedMap,n,e,r)})}(ts(n),n.object));let a=null!==n.props.dispose&&!1!==t;for(let e=n.children.length-1;e>=0;e--){let t=n.children[e];tJ(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&tZ(n.object),void 0===t&&tw(n)}let t0=[],t1=()=>{},t3={},t2=0,t4=(f={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return tq(e=tW(e)in tV?e:e.replace(tz,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tE(n.object,t,e,n)},removeChild:tJ,appendChild:t$,appendInitialChild:t$,insertBefore:tQ,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t$(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&tJ(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&tQ(r,n,t)},getRootHostContext:()=>t3,getChildHostContext:()=>t3,commitUpdate(e,n,t,r,a){var i,o,l;tq(n,r);let s=!1;if("primitive"===e.type&&t.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=t.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,n)=>{var r;return e!==(null==(r=t.args)?void 0:r[n])})&&(s=!0),s)t0.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tR.includes(r)&&!tv.equ(n[r],e.props[r]))for(let e in t[r]=n[r],n)e.startsWith(`${r}-`)&&(t[e]=n[e]);for(let r in e.props){if(tR.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tT(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tC.get(e.constructor);try{n||(n=new e.constructor,tC.set(e.constructor,n))}catch(e){}return n}(a);tv.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tP(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t0){let n=e.parent;if(n)for(let t of(e.props.attach?tx(n,e):tL(e.object)&&tL(n.object)&&n.object.remove(e.object),e.children))t.props.attach?tx(e,t):tL(t.object)&&tL(e.object)&&e.object.remove(t.object);e.isHidden&&tY(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&tZ(e.object)}for(let[r,a,i]of t0){r.props=a;let o=r.parent;if(o){let a=tV[tW(r.type)];r.object=null!=(e=r.props.object)?e:new a(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r;var e,n,t=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let n=e.ref(t);"function"==typeof n&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t);for(let e of(tP(r.object,r.props),r.props.attach?tM(o,r):tL(r.object)&&tL(o.object)&&o.object.add(r.object),r.children))e.props.attach?tM(r,e):tL(e.object)&&tL(r.object)&&r.object.add(e.object);tw(r)}}t0.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tE(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tx(e.parent,e):tL(e.object)&&(e.object.visible=!1),e.isHidden=!0,tw(e)}},unhideInstance:tY,createTextInstance:t1,hideTextInstance:t1,unhideTextInstance:t1,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:p.createContext(null),setCurrentUpdatePriority(e){t2=e},getCurrentUpdatePriority:()=>t2,resolveUpdatePriority(){var e;if(0!==t2)return t2;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return m.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return m.ContinuousEventPriority;default:return m.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.4.2"},(u=(0,n6.default)(f)).injectIntoDevTools(),u),t5=new Map,t6={objects:"shallow",strict:!1};function t8(e){var n,t;let r,a,i,o,l,s,u,c,d,f=t5.get(e),g=null==f?void 0:f.fiber,_=null==f?void 0:f.store;f&&console.warn("R3F.createRoot should only be called once!");let v="function"==typeof reportError?reportError:console.error,S=_||(n=rf,t=rp,u=(s=(l=(i=(e,r)=>{let a,i=new h.Vector3,o=new h.Vector3,l=new h.Vector3;function s(e=r().camera,n=o,t=r().size){let{width:a,height:u,top:c,left:d}=t,f=a/u;n.isVector3?l.copy(n):l.set(...n);let p=e.getWorldPosition(i).distanceTo(l);if(e&&e.isOrthographicCamera)return{width:a/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let n=2*Math.tan(e.fov*Math.PI/180/2)*p,t=a/u*n;return{width:t,height:n,top:c,left:d,factor:a/t,distance:p,aspect:f}}}let u=n=>e(e=>({performance:{...e.performance,current:n}})),c=new h.Vector2;return{set:e,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>n(r(),e),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new h.Clock,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();a&&clearTimeout(a),e.performance.current!==e.performance.min&&u(e.performance.min),a=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:n=>e(e=>({...e,events:{...e.events,...n}})),setSize:(n,t,a=0,i=0)=>{let l=r().camera,u={width:n,height:t,top:a,left:i};e(e=>({size:u,viewport:{...e.viewport,...s(l,o,u)}}))},setDpr:n=>e(e=>{let t=tg(n);return{viewport:{...e.viewport,dpr:t,initialDpr:e.viewport.initialDpr||t}}}),setFrameloop:(n="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==n&&(t.start(),t.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:p.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,t)=>{let a=r().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:t}),a.subscribers=a.subscribers.sort((e,n)=>e.priority-n.priority),()=>{let t=r().internal;null!=t&&t.subscribers&&(t.priority=t.priority-(n>0),t.subscribers=t.subscribers.filter(n=>n.ref!==e))}}}}})?n3(i,o):n3).getState()).size,c=s.viewport.dpr,d=s.camera,l.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=l.getState();if(n.width!==u.width||n.height!==u.height||t.dpr!==c){u=n,c=t.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(n.width/2),e.right=n.width/2,e.top=n.height/2,e.bottom=-(n.height/2)):e.aspect=n.width/n.height,e.updateProjectionMatrix());t.dpr>0&&r.setPixelRatio(t.dpr);let a="undefined"!=typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(n.width,n.height,a)}e!==d&&(d=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),l.subscribe(e=>n(e)),l),E=g||t4.createContainer(S,m.ConcurrentRoot,null,!1,null,"",v,v,v,null);f||t5.set(e,{fiber:E,store:S});let T=!1,b=null;return{async configure(n={}){var t,i;let o;b=new Promise(e=>o=e);let{gl:l,size:s,scene:u,events:c,onCreated:d,shadows:f=!1,linear:p=!1,flat:m=!1,legacy:g=!1,orthographic:_=!1,frameloop:v="always",dpr:E=[1,2],performance:M,raycaster:x,camera:R,onPointerMissed:C}=n,y=S.getState(),A=y.gl;if(!y.gl){let n={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},t="function"==typeof l?await l(n):l;A=tN(t)?t:new nQ({...n,...l}),y.set({gl:A})}let P=y.raycaster;P||y.set({raycaster:P=new h.Raycaster});let{params:w,...L}=x||{};if(tv.equ(L,P,t6)||tP(P,{...L}),tv.equ(w,P.params,t6)||tP(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tv.equ(a,R,t6)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:_?new h.OrthographicCamera(0,0,0,0,.1,1e3):new h.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tP(n,R),!n.manual&&("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(n.manual=!0,n.updateProjectionMatrix())),y.camera||null!=R&&R.rotation||n.lookAt(0,0,0)),y.set({camera:n}),P.camera=n}if(!y.scene){let e;null!=u&&u.isScene?tE(e=u,S,"",{}):(tE(e=new h.Scene,S,"",{}),u&&tP(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(S)});let U=function(e,n){if(!n&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:n,height:t,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:n,height:t,top:r,left:a}}return!n&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...n}}(e,s);if(tv.equ(U,y.size,t6)||y.setSize(U.width,U.height,U.top,U.left),E&&y.viewport.dpr!==tg(E)&&y.setDpr(E),y.frameloop!==v&&y.setFrameloop(v),y.onPointerMissed||y.set({onPointerMissed:C}),M&&!tv.equ(M,y.performance,t6)&&y.set(e=>({performance:{...e.performance,...M}})),!y.xr){let e=(e,n)=>{let t=S.getState();"never"!==t.frameloop&&rp(e,!0,t,n)},n=()=>{let n=S.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rf(n)},r={connect(){let e=S.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=S.getState().gl;e.xr.removeEventListener("sessionstart",n),e.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(t=A.xr)?void 0:t.addEventListener)&&r.connect(),y.set({xr:r})}if(A.shadowMap){let e=A.shadowMap.enabled,n=A.shadowMap.type;if(A.shadowMap.enabled=!!f,tv.boo(f))A.shadowMap.type=h.PCFSoftShadowMap;else if(tv.str(f)){let e={basic:h.BasicShadowMap,percentage:h.PCFShadowMap,soft:h.PCFSoftShadowMap,variance:h.VSMShadowMap};A.shadowMap.type=null!=(i=e[f])?i:h.PCFSoftShadowMap}else tv.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return h.ColorManagement.enabled=!g,T||(A.outputColorSpace=p?h.LinearSRGBColorSpace:h.SRGBColorSpace,A.toneMapping=m?h.NoToneMapping:h.ACESFilmicToneMapping),y.legacy!==g&&y.set(()=>({legacy:g})),y.linear!==p&&y.set(()=>({linear:p})),y.flat!==m&&y.set(()=>({flat:m})),!l||tv.fun(l)||tN(l)||tv.equ(l,A,t6)||tP(A,l),r=d,T=!0,o(),this},render(n){return T||b||this.configure(),b.then(()=>{t4.updateContainer((0,n9.jsx)(t9,{store:S,children:n,onCreated:r,rootElement:e}),E,null,()=>void 0)}),S},unmount(){t7(e)}}}function t9({store:e,children:n,onCreated:t,rootElement:r}){return td(()=>{let n=e.getState();n.set(e=>({internal:{...e.internal,active:!0}})),t&&t(n),e.getState().events.connected||null==n.events.connect||n.events.connect(r)},[]),(0,n9.jsx)(tI.Provider,{value:e,children:n})}function t7(e,n){let t=t5.get(e),r=null==t?void 0:t.fiber;if(r){let a=null==t?void 0:t.store.getState();a&&(a.internal.active=!1),t4.updateContainer(null,r,null,()=>{a&&setTimeout(()=>{try{null==a.events.disconnect||a.events.disconnect(),null==(t=a.gl)||null==(r=t.renderLists)||null==r.dispose||r.dispose(),null==(i=a.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=a.gl)&&o.xr&&a.xr.disconnect();var t,r,i,o,l=a.scene;for(let e in"Scene"!==l.type&&(null==l.dispose||l.dispose()),l){let n=l[e];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}t5.delete(e),n&&n(e)}catch(e){}},500)})}}function re(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let rn=new Set,rt=new Set,rr=new Set,ra=e=>re(e,rn),ri=e=>re(e,rt);function ro(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rl(e,n){switch(e){case"before":return ro(rn,n);case"after":return ro(rt,n);case"tail":return ro(rr,n)}}function rs(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),n=r.internal.subscribers;for(let e=0;e0)&&!(null!=(n=i.gl.xr)&&n.isPresenting)&&(r+=rs(e,i))}if(rc=!1,rl("after",e),0===r)return rl("tail",e),ru=!1,cancelAnimationFrame(a)}function rf(e,n=1){var t;if(!e)return t5.forEach(e=>rf(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):rc?e.internal.frames=2:e.internal.frames=1,ru||(ru=!0,requestAnimationFrame(rd)))}function rp(e,n=!0,t,r){if(n&&rl("before",e),t)rs(e,t,r);else for(let n of t5.values())rs(e,n.store.getState());n&&rl("after",e)}let rm={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rh(e){let{handlePointer:n}=function(e){function n(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(n=>{var t;return null==(t=e.__r3f)?void 0:t.handlers["onPointer"+n]}))}function t(n){let{internal:t}=e.getState();for(let e of t.hovered.values())if(!n.length||!n.find(n=>n.object===e.object&&n.index===e.index&&n.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(t.hovered.delete(tU(e)),null!=r&&r.eventCount){let t=r.handlers,a={...e,intersections:n};null==t.onPointerOut||t.onPointerOut(a),null==t.onPointerLeave||t.onPointerLeave(a)}}}function r(e,n){for(let t=0;tt([]);case"onLostPointerCapture":return n=>{let{internal:r}=e.getState();"pointerId"in n&&r.capturedMap.has(n.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(n.pointerId)&&(r.capturedMap.delete(n.pointerId),t([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(n,t){let r=e.getState(),a=new Set,i=[],o=t?t(r.internal.interaction):r.internal.interaction;for(let e=0;e{let t=t_(e.object),r=t_(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tU(e);return!a.has(n)&&(a.add(n),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let n=e.object;for(;n;){var s;null!=(s=n.__r3f)&&s.eventCount&&i.push({...e,eventObject:n}),n=n.parent}}if("pointerId"in n&&r.internal.capturedMap.has(n.pointerId))for(let e of r.internal.capturedMap.get(n.pointerId).values())a.has(tU(e.intersection))||i.push(e.intersection);return i}(i,s?n:void 0),d=u?function(n){let{internal:t}=e.getState(),r=n.offsetX-t.initialClick[0],a=n.offsetY-t.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&t(c),!function(e,n,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=t_(o.object);if(l||o.object.traverseAncestors(e=>{let n=t_(e);if(n)return l=n,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new h.Vector3(u.x,u.y,0).unproject(c),p=e=>{var n,t;return null!=(n=null==(t=d.capturedMap.get(e))?void 0:t.has(o.eventObject))&&n},m=e=>{let t={intersection:o,target:n.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),n.target.setPointerCapture(e)},g=e=>{let n=d.capturedMap.get(e);n&&tD(d.capturedMap,o.eventObject,n,e)},_={};for(let e in n){let t=n[e];"function"!=typeof t&&(_[e]=t)}let v={...o,..._,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in n&&d.capturedMap.get(n.pointerId);(!r||r.has(o.eventObject))&&(v.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&t([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},nativeEvent:n};if(a(v),!0===i.stopped)break}}}}(c,i,d,function(e){let n=e.eventObject,t=n.__r3f;if(!(null!=t&&t.eventCount))return;let o=t.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let n=tU(e),t=l.hovered.get(n);t?t.stopped&&e.stopPropagation():(l.hovered.set(n,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let t=o[a];t?(!u||l.initialHits.includes(n))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),t(e)):u&&l.initialHits.includes(n)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,n,t){n.pointer.set(e.offsetX/n.size.width*2-1,-(2*(e.offsetY/n.size.height))+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(rm).reduce((e,t)=>({...e,[t]:n(t)}),{}),update:()=>{var n;let{events:t,internal:r}=e.getState();null!=(n=r.lastEvent)&&n.current&&t.handlers&&t.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{let{set:t,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),t(e=>({events:{...e.events,connected:n}})),r.handlers)for(let e in r.handlers){let t=r.handlers[e],[a,i]=rm[e];n.addEventListener(a,t,{passive:i})}},disconnect:()=>{let{set:n,events:t}=e.getState();if(t.connected){if(t.handlers)for(let e in t.handlers){let n=t.handlers[e],[r]=rm[e];t.connected.removeEventListener(r,n)}n(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>tm,"C",()=>tO,"D",()=>tB,"E",()=>th,"G",()=>tH,"a",()=>tf,"b",()=>td,"c",()=>t8,"d",()=>t7,"e",()=>tj,"f",()=>rh,"i",()=>tu,"j",()=>ra,"k",()=>ri,"u",()=>tp],91037)},49774,e=>{"use strict";var n=e.i(91037);e.s(["useFrame",()=>n.D])},73949,e=>{"use strict";var n=e.i(91037);e.s(["useThree",()=>n.C])},79123,e=>{"use strict";var n=e.i(43476),t=e.i(71645);let r=(0,t.createContext)(null),a=(0,t.createContext)(null),i=(0,t.createContext)(null);function o(){return(0,t.useContext)(r)}function l(){return(0,t.useContext)(a)}function s(){return(0,t.useContext)(i)}function u({children:e,fogEnabledOverride:o,onClearFogEnabledOverride:l}){let[s,u]=(0,t.useState)(!0),[c,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(1),[m,h]=(0,t.useState)(90),[g,_]=(0,t.useState)(!1),[v,S]=(0,t.useState)(!0),[E,T]=(0,t.useState)(!1),[b,M]=(0,t.useState)("moveLookStick"),x=(0,t.useCallback)(e=>{u(e),l()},[l]),R=(0,t.useMemo)(()=>({fogEnabled:o??s,setFogEnabled:x,highQualityFog:c,setHighQualityFog:d,fov:m,setFov:h,audioEnabled:g,setAudioEnabled:_,animationEnabled:v,setAnimationEnabled:S}),[s,o,x,c,m,g,v]),C=(0,t.useMemo)(()=>({debugMode:E,setDebugMode:T}),[E,T]),y=(0,t.useMemo)(()=>({speedMultiplier:f,setSpeedMultiplier:p,touchMode:b,setTouchMode:M}),[f,p,b,M]);(0,t.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&T(e.debugMode),null!=e.audioEnabled&&_(e.audioEnabled),null!=e.animationEnabled&&S(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&d(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&h(e.fov),null!=e.touchMode&&M(e.touchMode)},[]);let A=(0,t.useRef)(null);return(0,t.useEffect)(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:s,highQualityFog:c,speedMultiplier:f,fov:m,audioEnabled:g,animationEnabled:v,debugMode:E,touchMode:b}))}catch(e){}},500),()=>{A.current&&clearTimeout(A.current)}),[s,c,f,m,g,v,E,b]),(0,n.jsx)(r.Provider,{value:R,children:(0,n.jsx)(a.Provider,{value:C,children:(0,n.jsx)(i.Provider,{value:y,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>s,"useDebug",()=>l,"useSettings",()=>o])}]); \ No newline at end of file +}`;class nz{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let t=new g.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=t}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,t=new g.ShaderMaterial({vertexShader:nH,fragmentShader:nV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new g.Mesh(new g.PlaneGeometry(20,20),t)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nW extends g.EventDispatcher{constructor(e,n){super();const t=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="undefined"!=typeof XRWebGLBinding,h=new nz,v={},S=n.getContextAttributes();let E=null,T=null;const b=[],M=[],x=new g.Vector2;let R=null;const C=new g.PerspectiveCamera;C.viewport=new g.Vector4;const y=new g.PerspectiveCamera;y.viewport=new g.Vector4;const A=[C,y],P=new g.ArrayCamera;let w=null,L=null;function U(e){let n=M.indexOf(e.inputSource);if(-1===n)return;let t=b[n];void 0!==t&&(t.update(e.inputSource,e.frame,s||i),t.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",N);for(let e=0;e=0&&(M[r]=null,b[r].disconnect(t))}for(let n=0;n=M.length){M.push(t),r=e;break}else if(null===M[e]){M[e]=t,r=e;break}if(-1===r)break}let a=b[r];a&&a.connect(t)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getGripSpace()},this.getHand=function(e){let n=b[e];return void 0===n&&(n=new g.WebXRController,b[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===t.isPresenting&&(0,g.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,n)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(E=e.getRenderTarget(),r.addEventListener("select",U),r.addEventListener("selectstart",U),r.addEventListener("selectend",U),r.addEventListener("squeeze",U),r.addEventListener("squeezestart",U),r.addEventListener("squeezeend",U),r.addEventListener("end",D),r.addEventListener("inputsourceschange",N),!0!==S.xrCompatible&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(x),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let t=null,i=null,o=null;S.depth&&(o=S.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,t=S.stencil?g.DepthStencilFormat:g.DepthFormat,i=S.stencil?g.UnsignedInt248Type:g.UnsignedIntType);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new g.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,depthTexture:new g.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:4*!!S.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let t={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,n,t),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),T=new g.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:g.RGBAFormat,type:g.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),t.isPresenting=!0,t.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new g.Vector3,F=new g.Vector3;function O(e,n){null===n?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(n.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,t,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),P.near=y.near=C.near=i,P.far=y.far=C.far=o,(w!==P.near||L!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),w=P.near,L=P.far),P.layers.mask=6|e.layers.mask,C.layers.mask=3&P.layers.mask,y.layers.mask=5&P.layers.mask;let l=e.parent,s=P.cameras;O(P,l);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let a=n.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,nX.copy(o),nX.x*=-1,nX.y*=-1,nX.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(nX.y*=-1,nX.z*=-1),e.envMapRotation.value.setFromMatrix4(nj.makeRotationFromEuler(nX)),e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,t(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,t(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,t){t.color.getRGB(n.fogColor.value,(0,g.getUnlitUniformColorSpace)(e)),t.isFog?(n.fogNear.value=t.near,n.fogFar.value=t.far):t.isFogExp2&&(n.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,_,v,S,E,T,b,M,x,R,C,y,A,P,w,L;let U;a.isMeshBasicMaterial||a.isMeshLambertMaterial?r(e,a):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,_=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,t(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,t(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,t(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,t(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,t(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===g.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,t(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,t(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,t(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,t(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,t(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,t(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,t(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),v=e,(S=a).matcap&&(v.matcap.value=S.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),E=e,T=a,U=n.get(T).light,E.referencePosition.value.setFromMatrixPosition(U.matrixWorld),E.nearDistance.value=U.shadow.camera.near,E.farDistance.value=U.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(b=e,M=a,b.diffuse.value.copy(M.color),b.opacity.value=M.opacity,M.map&&(b.map.value=M.map,t(M.map,b.mapTransform)),a.isLineDashedMaterial&&(x=e,R=a,x.dashSize.value=R.dashSize,x.totalSize.value=R.dashSize+R.gapSize,x.scale.value=R.scale)):a.isPointsMaterial?(C=e,y=a,A=i,P=o,C.diffuse.value.copy(y.color),C.opacity.value=y.opacity,C.size.value=y.size*A,C.scale.value=.5*P,y.map&&(C.map.value=y.map,t(y.map,C.uvTransform)),y.alphaMap&&(C.alphaMap.value=y.alphaMap,t(y.alphaMap,C.alphaMapTransform)),y.alphaTest>0&&(C.alphaTest.value=y.alphaTest)):a.isSpriteMaterial?(w=e,L=a,w.diffuse.value.copy(L.color),w.opacity.value=L.opacity,w.rotation.value=L.rotation,L.map&&(w.map.value=L.map,t(L.map,w.mapTransform)),L.alphaMap&&(w.alphaMap.value=L.alphaMap,t(L.alphaMap,w.alphaMapTransform)),L.alphaTest>0&&(w.alphaTest.value=L.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function nY(e,n,t,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,g.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):(0,g.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function u(n){let t=n.target;t.removeEventListener("dispose",u);let r=o.indexOf(t.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[t.id]),delete a[t.id],delete i[t.id]}return{bind:function(e,n){let t=n.program;r.uniformBlockBinding(e,t)},update:function(t,c){var d;let f,p,m,h,_=a[t.id];void 0===_&&(function(e){let n=e.uniforms,t=0;for(let e=0,r=n.length;e0&&(t+=16-r),e.__size=t,e.__cache={}}(t),(d=t).__bindingPointIndex=f=function(){for(let e=0;ep.matrixWorld.determinant(),S=function(e,n,t,i,c){var d,f;!0!==n.isScene&&(n=eF),l.resetTextureUnits();let p=n.fog,h=i.isMeshStandardMaterial?n.environment:null,_=null===em?ec.outputColorSpace:!0===em.isXRRenderTarget?em.texture.colorSpace:g.LinearSRGBColorSpace,v=(i.isMeshStandardMaterial?u:s).get(i.envMap||h),S=!0===i.vertexColors&&!!t.attributes.color&&4===t.attributes.color.itemSize,T=!!t.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),b=!!t.morphAttributes.position,x=!!t.morphAttributes.normal,R=!!t.morphAttributes.color,C=g.NoToneMapping;i.toneMapped&&(null===em||!0===em.isXRRenderTarget)&&(C=ec.toneMapping);let y=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,A=void 0!==y?y.length:0,P=o.get(i),w=eo.state.lights;if(!0===eL&&(!0===eU||e!==eg)){let n=e===eg&&i.id===eh;E.setState(i,e,n)}let L=!1;i.version===P.__version?P.needsLights&&P.lightsStateVersion!==w.state.version||P.outputColorSpace!==_||c.isBatchedMesh&&!1===P.batching?L=!0:c.isBatchedMesh||!0!==P.batching?c.isBatchedMesh&&!0===P.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===P.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===P.instancing?L=!0:c.isInstancedMesh||!0!==P.instancing?c.isSkinnedMesh&&!1===P.skinning?L=!0:c.isSkinnedMesh||!0!==P.skinning?c.isInstancedMesh&&!0===P.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===P.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===P.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===P.instancingMorph&&null!==c.morphTexture||P.envMap!==v||!0===i.fog&&P.fog!==p||void 0!==P.numClippingPlanes&&(P.numClippingPlanes!==E.numPlanes||P.numIntersection!==E.numIntersection)||P.vertexAlphas!==S||P.vertexTangents!==T||P.morphTargets!==b||P.morphNormals!==x||P.morphColors!==R||P.toneMapping!==C?L=!0:P.morphTargetsCount!==A&&(L=!0):L=!0:L=!0:L=!0:(L=!0,P.__version=i.version);let U=P.currentProgram;!0===L&&(U=e4(i,n,c));let D=!1,I=!1,F=!1,O=U.getUniforms(),B=P.uniforms;if(a.useProgram(U.program)&&(D=!0,I=!0,F=!0),i.id!==eh&&(eh=i.id,I=!0),D||eg!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(eG,"projectionMatrix",e.projectionMatrix),O.setValue(eG,"viewMatrix",e.matrixWorldInverse);let n=O.map.cameraPosition;void 0!==n&&n.setValue(eG,eN.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&O.setValue(eG,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&O.setValue(eG,"isOrthographic",!0===e.isOrthographicCamera),eg!==e&&(eg=e,I=!0,F=!0)}if(P.needsLights&&(w.state.directionalShadowMap.length>0&&O.setValue(eG,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&O.setValue(eG,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&O.setValue(eG,"pointShadowMap",w.state.pointShadowMap,l)),c.isSkinnedMesh){O.setOptional(eG,c,"bindMatrix"),O.setOptional(eG,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eG,"boneTexture",e.boneTexture,l))}c.isBatchedMesh&&(O.setOptional(eG,c,"batchingTexture"),O.setValue(eG,"batchingTexture",c._matricesTexture,l),O.setOptional(eG,c,"batchingIdTexture"),O.setValue(eG,"batchingIdTexture",c._indirectTexture,l),O.setOptional(eG,c,"batchingColorTexture"),null!==c._colorsTexture&&O.setValue(eG,"batchingColorTexture",c._colorsTexture,l));let G=t.morphAttributes;if((void 0!==G.position||void 0!==G.normal||void 0!==G.color)&&M.update(c,t,U),(I||P.receiveShadow!==c.receiveShadow)&&(P.receiveShadow=c.receiveShadow,O.setValue(eG,"receiveShadow",c.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(B.envMap.value=v,B.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==n.environment&&(B.envMapIntensity.value=n.environmentIntensity),void 0!==B.dfgLUT&&(B.dfgLUT.value=(null===n$&&((n$=new g.DataTexture(nK,16,16,g.RGFormat,g.HalfFloatType)).name="DFG_LUT",n$.minFilter=g.LinearFilter,n$.magFilter=g.LinearFilter,n$.wrapS=g.ClampToEdgeWrapping,n$.wrapT=g.ClampToEdgeWrapping,n$.generateMipmaps=!1,n$.needsUpdate=!0),n$)),I&&(O.setValue(eG,"toneMappingExposure",ec.toneMappingExposure),P.needsLights&&(d=B,f=F,d.ambientLightColor.needsUpdate=f,d.lightProbe.needsUpdate=f,d.directionalLights.needsUpdate=f,d.directionalLightShadows.needsUpdate=f,d.pointLights.needsUpdate=f,d.pointLightShadows.needsUpdate=f,d.spotLights.needsUpdate=f,d.spotLightShadows.needsUpdate=f,d.rectAreaLights.needsUpdate=f,d.hemisphereLights.needsUpdate=f),p&&!0===i.fog&&m.refreshFogUniforms(B,p),m.refreshMaterialUniforms(B,i,ex,eM,eo.state.transmissionRenderTarget[e.id]),e2.upload(eG,e5(P),B,l)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e2.upload(eG,e5(P),B,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&O.setValue(eG,"center",c.center),O.setValue(eG,"modelViewMatrix",c.modelViewMatrix),O.setValue(eG,"normalMatrix",c.normalMatrix),O.setValue(eG,"modelMatrix",c.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){let e=i.uniformsGroups;for(let n=0,t=e.length;n{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?n(e):setTimeout(r,10)}null!==t.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eY=null;function eK(){eQ.stop()}function e$(){eQ.start()}const eQ=new _;function eZ(e,n,t,r){if(!1===e.visible)return;if(e.layers.test(n.layers)){if(e.isGroup)t=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)eo.pushLight(e),e.castShadow&&eo.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ew.intersectsSprite(e)){r&&eI.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eD);let n=f.update(e),a=e.material;a.visible&&ei.push(e,n,a,t,eI.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ew.intersectsObject(e))){let n=f.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eI.copy(e.boundingSphere.center)):(null===n.boundingSphere&&n.computeBoundingSphere(),eI.copy(n.boundingSphere.center)),eI.applyMatrix4(e.matrixWorld).applyMatrix4(eD)),Array.isArray(a)){let r=n.groups;for(let i=0,o=r.length;i0&&e1(i,n,t),o.length>0&&e1(o,n,t),l.length>0&&e1(l,n,t),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e0(e,n,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===eo.state.transmissionRenderTarget[i.id]){let e=t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float");eo.state.transmissionRenderTarget[i.id]=new g.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?g.HalfFloatType:g.UnsignedByteType,minFilter:g.LinearMipmapLinearFilter,samples:r.samples,stencilBuffer:B,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:g.ColorManagement.workingColorSpace})}let o=eo.state.transmissionRenderTarget[i.id],s=i.viewport||e_;o.setSize(s.z*ec.transmissionResolutionScale,s.w*ec.transmissionResolutionScale);let u=ec.getRenderTarget(),c=ec.getActiveCubeFace(),d=ec.getActiveMipmapLevel();ec.setRenderTarget(o),ec.getClearColor(eE),(eT=ec.getClearAlpha())<1&&ec.setClearColor(0xffffff,.5),ec.clear(),eO&&b.render(a);let f=ec.toneMapping;ec.toneMapping=g.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),eo.setupLightsView(i),!0===eL&&E.setGlobalState(ec.clippingPlanes,i),e1(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===t.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let t=0,r=n.length;t0)for(let n=0,i=a.length;n0&&e0(t,r,e,n),eO&&b.render(e),eJ(ei,e,n)}null!==em&&0===ep&&(l.updateMultisampleRenderTarget(em),l.updateRenderTargetMipmap(em)),r&&eu.end(ec),!0===e.isScene&&e.onAfterRender(ec,e,n),D.resetDefaultState(),eh=-1,eg=null,es.pop(),es.length>0?(eo=es[es.length-1],!0===eL&&E.setGlobalState(ec.clippingPlanes,eo.state.camera)):eo=null,el.pop(),ei=el.length>0?el[el.length-1]:null},this.getActiveCubeFace=function(){return ef},this.getActiveMipmapLevel=function(){return ep},this.getRenderTarget=function(){return em},this.setRenderTargetTextures=function(e,n,t){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=n,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:t,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,n){let t=o.get(e);t.__webglFramebuffer=n,t.__useDefaultFramebuffer=void 0===n};const e8=eG.createFramebuffer();this.setRenderTarget=function(e,n=0,t=0){em=e,ef=n,ep=t;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eG.FRAMEBUFFER,u.__webglFramebuffer),e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest,a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),eh=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let n=e.depthTexture;if(u.__boundDepthTexture!==n){if(null!==n&&o.has(n)&&(e.width!==n.image.width||e.height!==n.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(d[n])?d[n][t]:d[n],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[t]:d,e_.copy(e.viewport),ev.copy(e.scissor),eS=e.scissorTest}else e_.copy(ey).multiplyScalar(ex).floor(),ev.copy(eA).multiplyScalar(ex).floor(),eS=eP;if(0!==t&&(r=e8),a.bindFramebuffer(eG.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(e_),a.scissor(ev),a.setScissorTest(eS),i){let r=o.get(e.texture);eG.framebufferTexture2D(eG.FRAMEBUFFER,eG.COLOR_ATTACHMENT0,eG.TEXTURE_CUBE_MAP_POSITIVE_X+n,r.__webglTexture,t)}else if(s)for(let r=0;r=0&&n<=e.width-i&&t>=0&&t<=e.height-l&&(e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(o),U.convert(u),s))}finally{let e=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,t,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(n>=0&&n<=e.width-i&&t>=0&&t<=e.height-l){a.bindFramebuffer(eG.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eG.createBuffer();eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.bufferData(eG.PIXEL_PACK_BUFFER,s.byteLength,eG.STREAM_READ),e.textures.length>1&&eG.readBuffer(eG.COLOR_ATTACHMENT0+c),eG.readPixels(n,t,i,l,U.convert(f),U.convert(p),0);let h=null!==em?o.get(em).__webglFramebuffer:null;a.bindFramebuffer(eG.FRAMEBUFFER,h);let _=eG.fenceSync(eG.SYNC_GPU_COMMANDS_COMPLETE,0);return eG.flush(),await (0,g.probeAsync)(eG,_,4),eG.bindBuffer(eG.PIXEL_PACK_BUFFER,m),eG.getBufferSubData(eG.PIXEL_PACK_BUFFER,0,s),eG.deleteBuffer(m),eG.deleteSync(_),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,n=null,t=0){let r=Math.pow(2,-t),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==n?n.x:0,u=null!==n?n.y:0;l.setTexture2D(e,0),eG.copyTexSubImage2D(eG.TEXTURE_2D,t,0,0,s,u,i,o),a.unbindTexture()};const e9=eG.createFramebuffer(),e7=eG.createFramebuffer();this.copyTextureToTexture=function(e,n,t=null,r=null,i=0,s=null){let u,c,d,f,p,m,h,_,v,S;null===s&&(0!==i?((0,g.warnOnce)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);let E=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==t)u=t.max.x-t.min.x,c=t.max.y-t.min.y,d=t.isBox3?t.max.z-t.min.z:1,f=t.min.x,p=t.min.y,m=t.isBox3?t.min.z:0;else{let n=Math.pow(2,-i);u=Math.floor(E.width*n),c=Math.floor(E.height*n),d=e.isDataArrayTexture?E.depth:e.isData3DTexture?Math.floor(E.depth*n):1,f=0,p=0,m=0}null!==r?(h=r.x,_=r.y,v=r.z):(h=0,_=0,v=0);let T=U.convert(n.format),b=U.convert(n.type);n.isData3DTexture?(l.setTexture3D(n,0),S=eG.TEXTURE_3D):n.isDataArrayTexture||n.isCompressedArrayTexture?(l.setTexture2DArray(n,0),S=eG.TEXTURE_2D_ARRAY):(l.setTexture2D(n,0),S=eG.TEXTURE_2D),eG.pixelStorei(eG.UNPACK_FLIP_Y_WEBGL,n.flipY),eG.pixelStorei(eG.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),eG.pixelStorei(eG.UNPACK_ALIGNMENT,n.unpackAlignment);let M=eG.getParameter(eG.UNPACK_ROW_LENGTH),x=eG.getParameter(eG.UNPACK_IMAGE_HEIGHT),R=eG.getParameter(eG.UNPACK_SKIP_PIXELS),C=eG.getParameter(eG.UNPACK_SKIP_ROWS),y=eG.getParameter(eG.UNPACK_SKIP_IMAGES);eG.pixelStorei(eG.UNPACK_ROW_LENGTH,E.width),eG.pixelStorei(eG.UNPACK_IMAGE_HEIGHT,E.height),eG.pixelStorei(eG.UNPACK_SKIP_PIXELS,f),eG.pixelStorei(eG.UNPACK_SKIP_ROWS,p),eG.pixelStorei(eG.UNPACK_SKIP_IMAGES,m);let A=e.isDataArrayTexture||e.isData3DTexture,P=n.isDataArrayTexture||n.isData3DTexture;if(e.isDepthTexture){let t=o.get(e),r=o.get(n),l=o.get(t.__renderTarget),g=o.get(r.__renderTarget);a.bindFramebuffer(eG.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eG.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let t=0;tG,"ShaderChunk",()=>S,"ShaderLib",()=>T,"UniformsLib",()=>E,"WebGLRenderer",()=>nQ,"WebGLUtils",()=>nk],8560);var nZ=e.i(30224);let nJ=e=>{let n,t=new Set,r=(e,r)=>{let a="function"==typeof e?e(n):e;if(!Object.is(a,n)){let e=n;n=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},n,a),t.forEach(t=>t(n,e))}},a=()=>n,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(t.add(e),()=>t.delete(e))},o=n=e(r,a,i);return i},n0=e=>e?nJ(e):nJ;e.s(["createStore",()=>n0],8155);let{useSyncExternalStoreWithSelector:n1}=nZ.default,n3=e=>e;function n2(e,n=n3,t){let r=n1(e.subscribe,e.getState,e.getInitialState,n,t);return p.default.useDebugValue(r),r}let n4=(e,n)=>{let t=n0(e),r=(e,r=n)=>n2(t,e,r);return Object.assign(r,t),r},n5=(e,n)=>e?n4(e,n):n4;e.s(["createWithEqualityFn",()=>n5,"useStoreWithEqualityFn",()=>n2],66748);let n6=[];function n8(e,n,t=(e,n)=>e===n){if(e===n)return!0;if(!e||!n)return!1;let r=e.length;if(n.length!==r)return!1;for(let a=0;a0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!t)throw a.promise}let a={keys:n,equal:r.equal,remove:()=>{let e=n6.indexOf(a);-1!==e&&n6.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...n)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(n6.push(a),!t)throw a.promise}var n7=e.i(98133),te=e.i(95087),tn=e.i(43476),tt=p;function tr(e,n,t){if(!e)return;if(!0===t(e))return e;let r=n?e.return:e.child;for(;r;){let e=tr(r,n,t);if(e)return e;r=n?null:r.sibling}}function ta(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(n){return e}}"undefined"!=typeof window&&((null==(c=window.document)?void 0:c.createElement)||(null==(d=window.navigator)?void 0:d.product)==="ReactNative")?tt.useLayoutEffect:tt.useEffect;let ti=ta(tt.createContext(null));class to extends tt.Component{render(){return tt.createElement(ti.Provider,{value:this._reactInternals},this.props.children)}}function tl(){let e=tt.useContext(ti);if(null===e)throw Error("its-fine: useFiber must be called within a !");let n=tt.useId();return tt.useMemo(()=>{for(let t of[e,null==e?void 0:e.alternate]){if(!t)continue;let e=tr(t,!1,e=>{let t=e.memoizedState;for(;t;){if(t.memoizedState===n)return!0;t=t.next}});if(e)return e}},[e,n])}let ts=Symbol.for("react.context"),tu=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ts;function tc(){let e=function(){let e=tl(),[n]=tt.useState(()=>new Map);n.clear();let t=e;for(;t;){let e=t.type;tu(e)&&e!==ti&&!n.has(e)&&n.set(e,tt.use(ta(e))),t=t.return}return n}();return tt.useMemo(()=>Array.from(e.keys()).reduce((n,t)=>r=>tt.createElement(n,null,tt.createElement(t.Provider,{...r,value:e.get(t)})),e=>tt.createElement(to,{...e})),[e])}function td(e){let n=e.root;for(;n.getState().previousRoot;)n=n.getState().previousRoot;return n}e.s(["FiberProvider",()=>to,"traverseFiber",()=>tr,"useContextBridge",()=>tc,"useFiber",()=>tl],46791),p.act;let tf=e=>e&&e.hasOwnProperty("current"),tp=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),tm="undefined"!=typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?p.useLayoutEffect:p.useEffect;function th(e){let n=p.useRef(e);return tm(()=>void(n.current=e),[e]),n}function tg(){let e=tl(),n=tc();return p.useMemo(()=>({children:t})=>{let r=tr(e,!0,e=>e.type===p.StrictMode)?p.StrictMode:p.Fragment;return(0,tn.jsx)(r,{children:(0,tn.jsx)(n,{children:t})})},[e,n])}function t_({set:e}){return tm(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let tv=((s=class extends p.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function tS(e){var n;let t="undefined"!=typeof window?null!=(n=window.devicePixelRatio)?n:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],t),e[1]):e}function tE(e){var n;return null==(n=e.__r3f)?void 0:n.root.getState()}let tT={obj:e=>e===Object(e)&&!tT.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,n,{arrays:t="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof n||!!e!=!!n)return!1;if(tT.str(e)||tT.num(e)||tT.boo(e))return e===n;let o=tT.obj(e);if(o&&"reference"===r)return e===n;let l=tT.arr(e);if(l&&"reference"===t)return e===n;if((l||o)&&e===n)return!0;for(i in e)if(!(i in n))return!1;if(o&&"shallow"===t&&"shallow"===r){for(i in a?n:e)if(!tT.equ(e[i],n[i],{strict:a,objects:"reference"}))return!1}else for(i in a?n:e)if(e[i]!==n[i])return!1;if(tT.und(i)){if(l&&0===e.length&&0===n.length||o&&0===Object.keys(e).length&&0===Object.keys(n).length)return!0;if(e!==n)return!1}return!0}},tb=["children","key","ref"];function tM(e,n,t,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:n,type:t,parent:null,children:[],props:function(e){let n={};for(let t in e)tb.includes(t)||(n[t]=e[t]);return n}(r),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=a)),a}function tx(e,n){if(!n.includes("-")||n in e)return{root:e,key:n,target:e[n]};let t=e,r=n.split("-");for(let a of r){if("object"!=typeof t||null===t){if(void 0!==t)return{root:t,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:n,target:void 0}}n=a,e=t,t=t[n]}return{root:e,key:n,target:t}}let tR=/-\d+$/;function tC(e,n){if(tT.str(n.props.attach)){if(tR.test(n.props.attach)){let t=n.props.attach.replace(tR,""),{root:r,key:a}=tx(e.object,t);Array.isArray(r[a])||(r[a]=[])}let{root:t,key:r}=tx(e.object,n.props.attach);n.previousAttach=t[r],t[r]=n.object}else tT.fun(n.props.attach)&&(n.previousAttach=n.props.attach(e.object,n.object))}function ty(e,n){if(tT.str(n.props.attach)){let{root:t,key:r}=tx(e.object,n.props.attach),a=n.previousAttach;void 0===a?delete t[r]:t[r]=a}else null==n.previousAttach||n.previousAttach(e.object,n.object);delete n.previousAttach}let tA=[...tb,"args","dispose","attach","object","onUpdate","dispose"],tP=new Map,tw=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],tL=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function tU(e,n){var t,r;let a=e.__r3f,i=a&&td(a).getState(),o=null==a?void 0:a.eventCount;for(let t in n){let o=n[t];if(tA.includes(t))continue;if(a&&tL.test(t)){"function"==typeof o?a.handlers[t]=o:delete a.handlers[t],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;let{root:l,key:s,target:u}=tx(e,t);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${t}". Ensure it is an object before setting "${s}".`);u instanceof h.Layers&&o instanceof h.Layers?u.mask=o.mask:u instanceof h.Color&&tp(o)?u.set(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor?u.copy(o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o)?"function"==typeof u.fromArray?u.fromArray(o):u.set(...o):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o?"function"==typeof u.setScalar?u.setScalar(o):u.set(o):(l[s]=o,i&&!i.linear&&tw.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===h.RGBAFormat&&l[s].type===h.UnsignedByteType&&(l[s].colorSpace=h.SRGBColorSpace))}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(t=a.object)&&t.isObject3D&&o!==a.eventCount){let e=a.object,n=i.internal.interaction.indexOf(e);n>-1&&i.internal.interaction.splice(n,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&tD(a),e}function tD(e){var n;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let t=null==(n=e.root)||null==n.getState?void 0:n.getState();t&&0===t.internal.frames&&t.invalidate()}let tN=e=>null==e?void 0:e.isObject3D;function tI(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function tF(e,n,t,r){let a=t.get(n);a&&(t.delete(n),0===t.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let tO=e=>!!(null!=e&&e.render),tB=p.createContext(null);function tG(){let e=p.useContext(tB);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function tk(e=e=>e,n){return tG()(e,n)}function tH(e,n=0){let t=tG(),r=t.getState().internal.subscribe,a=th(e);return tm(()=>r(a,n,t),[n,r,t]),null}let tV=new WeakMap;function tz(e,n){return function(t,...r){var a;let i;return"function"==typeof t&&(null==t||null==(a=t.prototype)?void 0:a.constructor)===t?(i=tV.get(t))||(i=new t,tV.set(t,i)):i=t,e&&e(i),Promise.all(r.map(e=>new Promise((t,r)=>i.load(e,e=>{var n;let r;tN(null==e?void 0:e.scene)&&Object.assign(e,(n=e.scene,r={nodes:{},materials:{},meshes:{}},n&&n.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),t(e)},n,n=>r(Error(`Could not load ${e}: ${null==n?void 0:n.message}`))))))}}function tW(e,n,t,r){let a=Array.isArray(n)?n:[n],i=n9(tz(t,r),[e,...a],!1,{equal:tT.equ});return Array.isArray(n)?i:i[0]}tW.preload=function(e,n,t){let r,a=Array.isArray(n)?n:[n];n9(tz(t),[e,...a],!0,r)},tW.clear=function(e,n){var t=[e,...Array.isArray(n)?n:[n]];if(void 0===t||0===t.length)n6.splice(0,n6.length);else{let e=n6.find(e=>n8(t,e.keys,e.equal));e&&e.remove()}};let tX={},tj=/^three(?=[A-Z])/,tq=e=>`${e[0].toUpperCase()}${e.slice(1)}`,tY=0;function tK(e){if("function"==typeof e){let n=`${tY++}`;return tX[n]=e,n}Object.assign(tX,e)}function t$(e,n){let t=tq(e),r=tX[t];if("primitive"!==e&&!r)throw Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!n.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==n.args&&!Array.isArray(n.args))throw Error("R3F: The args prop must be an array!")}function tQ(e){if(e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?tC(e.parent,e):tN(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,tD(e)}}function tZ(e,n,t){let r=n.root.getState();if(e.parent||e.object===r.scene){if(!n.object){var a,i;let e=tX[tq(n.type)];n.object=null!=(a=n.props.object)?a:new e(...null!=(i=n.props.args)?i:[]),n.object.__r3f=n}if(tU(n.object,n.props),n.props.attach)tC(e,n);else if(tN(n.object)&&tN(e.object)){let r=e.object.children.indexOf(null==t?void 0:t.object);if(t&&-1!==r){let t=e.object.children.indexOf(n.object);-1!==t?(e.object.children.splice(t,1),e.object.children.splice(t{try{e.dispose()}catch{}};"undefined"!=typeof IS_REACT_ACT_ENVIRONMENT?n():(0,te.unstable_scheduleCallback)(te.unstable_IdlePriority,n)}}function t3(e,n,t){if(!n)return;n.parent=null;let r=e.children.indexOf(n);-1!==r&&e.children.splice(r,1),n.props.attach?ty(e,n):tN(n.object)&&tN(e.object)&&(e.object.remove(n.object),function(e,n){let{internal:t}=e.getState();t.interaction=t.interaction.filter(e=>e!==n),t.initialHits=t.initialHits.filter(e=>e!==n),t.hovered.forEach((e,r)=>{(e.eventObject===n||e.object===n)&&t.hovered.delete(r)}),t.capturedMap.forEach((e,r)=>{tF(t.capturedMap,n,e,r)})}(td(n),n.object));let a=null!==n.props.dispose&&!1!==t;for(let e=n.children.length-1;e>=0;e--){let t=n.children[e];t3(n,t,a)}n.children.length=0,delete n.object.__r3f,a&&"primitive"!==n.type&&"Scene"!==n.object.type&&t1(n.object),void 0===t&&tD(n)}let t2=[],t4=()=>{},t5={},t6=0,t8=(f={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,n,t){var r;return t$(e=tq(e)in tX?e:e.replace(tj,""),n),"primitive"===e&&null!=(r=n.object)&&r.__r3f&&delete n.object.__r3f,tM(n.object,t,e,n)},removeChild:t3,appendChild:tJ,appendInitialChild:tJ,insertBefore:t0,appendChildToContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&tJ(t,n)},removeChildFromContainer(e,n){let t=e.getState().scene.__r3f;n&&t&&t3(t,n)},insertInContainerBefore(e,n,t){let r=e.getState().scene.__r3f;n&&t&&r&&t0(r,n,t)},getRootHostContext:()=>t5,getChildHostContext:()=>t5,commitUpdate(e,n,t,r,a){var i,o,l;t$(n,r);let s=!1;if("primitive"===e.type&&t.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=t.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,n)=>{var r;return e!==(null==(r=t.args)?void 0:r[n])})&&(s=!0),s)t2.push([e,{...r},a]);else{let n=function(e,n){let t={};for(let r in n)if(!tA.includes(r)&&!tT.equ(n[r],e.props[r]))for(let e in t[r]=n[r],n)e.startsWith(`${r}-`)&&(t[e]=n[e]);for(let r in e.props){if(tA.includes(r)||n.hasOwnProperty(r))continue;let{root:a,key:i}=tx(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let n=tP.get(e.constructor);try{n||(n=new e.constructor,tP.set(e.constructor,n))}catch(e){}return n}(a);tT.und(e)||(t[i]=e[i])}else t[i]=0}return t}(e,r);Object.keys(n).length&&(Object.assign(e.props,n),tU(e.object,n))}(null===a.sibling||(4&a.flags)==0)&&function(){for(let[e]of t2){let n=e.parent;if(n)for(let t of(e.props.attach?ty(n,e):tN(e.object)&&tN(n.object)&&n.object.remove(e.object),e.children))t.props.attach?ty(e,t):tN(t.object)&&tN(e.object)&&e.object.remove(t.object);e.isHidden&&tQ(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&t1(e.object)}for(let[r,a,i]of t2){r.props=a;let o=r.parent;if(o){let a=tX[tq(r.type)];r.object=null!=(e=r.props.object)?e:new a(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r;var e,n,t=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let n=e.ref(t);"function"==typeof n&&(e.refCleanup=n)}else e.ref&&(e.ref.current=t);for(let e of(tU(r.object,r.props),r.props.attach?tC(o,r):tN(r.object)&&tN(o.object)&&o.object.add(r.object),r.children))e.props.attach?tC(r,e):tN(e.object)&&tN(r.object)&&r.object.add(e.object);tD(r)}}t2.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>tM(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var n;e.props.attach&&null!=(n=e.parent)&&n.object?ty(e.parent,e):tN(e.object)&&(e.object.visible=!1),e.isHidden=!0,tD(e)}},unhideInstance:tQ,createTextInstance:t4,hideTextInstance:t4,unhideTextInstance:t4,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:p.createContext(null),setCurrentUpdatePriority(e){t6=e},getCurrentUpdatePriority:()=>t6,resolveUpdatePriority(){var e;if(0!==t6)return t6;switch("undefined"!=typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return m.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return m.ContinuousEventPriority;default:return m.DefaultEventPriority}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.4.2"},(u=(0,n7.default)(f)).injectIntoDevTools(),u),t9=new Map,t7={objects:"shallow",strict:!1};function re(e){var n,t;let r,a,i,o,l,s,u,c=t9.get(e),d=null==c?void 0:c.fiber,f=null==c?void 0:c.store;c&&console.warn("R3F.createRoot should only be called once!");let g="function"==typeof reportError?reportError:console.error,_=f||(n=rh,t=rg,l=(o=(i=n5((e,r)=>{let a,i=new h.Vector3,o=new h.Vector3,l=new h.Vector3;function s(e=r().camera,n=o,t=r().size){let{width:a,height:u,top:c,left:d}=t,f=a/u;n.isVector3?l.copy(n):l.set(...n);let p=e.getWorldPosition(i).distanceTo(l);if(e&&e.isOrthographicCamera)return{width:a/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let n=2*Math.tan(e.fov*Math.PI/180/2)*p,t=a/u*n;return{width:t,height:n,top:c,left:d,factor:a/t,distance:p,aspect:f}}}let u=n=>e(e=>({performance:{...e.performance,current:n}})),c=new h.Vector2;return{set:e,get:r,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>n(r(),e),advance:(e,n)=>t(e,n,r()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new h.Clock,pointer:c,mouse:c,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=r();a&&clearTimeout(a),e.performance.current!==e.performance.min&&u(e.performance.min),a=setTimeout(()=>u(r().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:n=>e(e=>({...e,events:{...e.events,...n}})),setSize:(n,t,a=0,i=0)=>{let l=r().camera,u={width:n,height:t,top:a,left:i};e(e=>({size:u,viewport:{...e.viewport,...s(l,o,u)}}))},setDpr:n=>e(e=>{let t=tS(n);return{viewport:{...e.viewport,dpr:t,initialDpr:e.viewport.initialDpr||t}}}),setFrameloop:(n="always")=>{let t=r().clock;t.stop(),t.elapsedTime=0,"never"!==n&&(t.start(),t.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:p.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,t)=>{let a=r().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:t}),a.subscribers=a.subscribers.sort((e,n)=>e.priority-n.priority),()=>{let t=r().internal;null!=t&&t.subscribers&&(t.priority=t.priority-(n>0),t.subscribers=t.subscribers.filter(n=>n.ref!==e))}}}}})).getState()).size,s=o.viewport.dpr,u=o.camera,i.subscribe(()=>{let{camera:e,size:n,viewport:t,gl:r,set:a}=i.getState();if(n.width!==l.width||n.height!==l.height||t.dpr!==s){l=n,s=t.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(n.width/2),e.right=n.width/2,e.top=n.height/2,e.bottom=-(n.height/2)):e.aspect=n.width/n.height,e.updateProjectionMatrix());t.dpr>0&&r.setPixelRatio(t.dpr);let a="undefined"!=typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(n.width,n.height,a)}e!==u&&(u=e,a(n=>({viewport:{...n.viewport,...n.viewport.getCurrentViewport(e)}})))}),i.subscribe(e=>n(e)),i),v=d||t8.createContainer(_,m.ConcurrentRoot,null,!1,null,"",g,g,g,null);c||t9.set(e,{fiber:v,store:_});let S=!1,E=null;return{async configure(n={}){var t,i;let o;E=new Promise(e=>o=e);let{gl:l,size:s,scene:u,events:c,onCreated:d,shadows:f=!1,linear:p=!1,flat:m=!1,legacy:g=!1,orthographic:v=!1,frameloop:T="always",dpr:b=[1,2],performance:M,raycaster:x,camera:R,onPointerMissed:C}=n,y=_.getState(),A=y.gl;if(!y.gl){let n={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},t="function"==typeof l?await l(n):l;A=tO(t)?t:new nQ({...n,...l}),y.set({gl:A})}let P=y.raycaster;P||y.set({raycaster:P=new h.Raycaster});let{params:w,...L}=x||{};if(tT.equ(L,P,t7)||tU(P,{...L}),tT.equ(w,P.params,t7)||tU(P,{params:{...P.params,...w}}),!y.camera||y.camera===a&&!tT.equ(a,R,t7)){a=R;let e=null==R?void 0:R.isCamera,n=e?R:v?new h.OrthographicCamera(0,0,0,0,.1,1e3):new h.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,R&&(tU(n,R),!n.manual&&("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(n.manual=!0,n.updateProjectionMatrix())),y.camera||null!=R&&R.rotation||n.lookAt(0,0,0)),y.set({camera:n}),P.camera=n}if(!y.scene){let e;null!=u&&u.isScene?tM(e=u,_,"",{}):(tM(e=new h.Scene,_,"",{}),u&&tU(e,u)),y.set({scene:e})}c&&!y.events.handlers&&y.set({events:c(_)});let U=function(e,n){if(!n&&"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:n,height:t,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:n,height:t,top:r,left:a}}return!n&&"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...n}}(e,s);if(tT.equ(U,y.size,t7)||y.setSize(U.width,U.height,U.top,U.left),b&&y.viewport.dpr!==tS(b)&&y.setDpr(b),y.frameloop!==T&&y.setFrameloop(T),y.onPointerMissed||y.set({onPointerMissed:C}),M&&!tT.equ(M,y.performance,t7)&&y.set(e=>({performance:{...e.performance,...M}})),!y.xr){let e=(e,n)=>{let t=_.getState();"never"!==t.frameloop&&rg(e,!0,t,n)},n=()=>{let n=_.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?e:null),n.gl.xr.isPresenting||rh(n)},r={connect(){let e=_.getState().gl;e.xr.addEventListener("sessionstart",n),e.xr.addEventListener("sessionend",n)},disconnect(){let e=_.getState().gl;e.xr.removeEventListener("sessionstart",n),e.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(t=A.xr)?void 0:t.addEventListener)&&r.connect(),y.set({xr:r})}if(A.shadowMap){let e=A.shadowMap.enabled,n=A.shadowMap.type;if(A.shadowMap.enabled=!!f,tT.boo(f))A.shadowMap.type=h.PCFSoftShadowMap;else if(tT.str(f)){let e={basic:h.BasicShadowMap,percentage:h.PCFShadowMap,soft:h.PCFSoftShadowMap,variance:h.VSMShadowMap};A.shadowMap.type=null!=(i=e[f])?i:h.PCFSoftShadowMap}else tT.obj(f)&&Object.assign(A.shadowMap,f);(e!==A.shadowMap.enabled||n!==A.shadowMap.type)&&(A.shadowMap.needsUpdate=!0)}return h.ColorManagement.enabled=!g,S||(A.outputColorSpace=p?h.LinearSRGBColorSpace:h.SRGBColorSpace,A.toneMapping=m?h.NoToneMapping:h.ACESFilmicToneMapping),y.legacy!==g&&y.set(()=>({legacy:g})),y.linear!==p&&y.set(()=>({linear:p})),y.flat!==m&&y.set(()=>({flat:m})),!l||tT.fun(l)||tO(l)||tT.equ(l,A,t7)||tU(A,l),r=d,S=!0,o(),this},render(n){return S||E||this.configure(),E.then(()=>{t8.updateContainer((0,tn.jsx)(rn,{store:_,children:n,onCreated:r,rootElement:e}),v,null,()=>void 0)}),_},unmount(){rt(e)}}}function rn({store:e,children:n,onCreated:t,rootElement:r}){return tm(()=>{let n=e.getState();n.set(e=>({internal:{...e.internal,active:!0}})),t&&t(n),e.getState().events.connected||null==n.events.connect||n.events.connect(r)},[]),(0,tn.jsx)(tB.Provider,{value:e,children:n})}function rt(e,n){let t=t9.get(e),r=null==t?void 0:t.fiber;if(r){let a=null==t?void 0:t.store.getState();a&&(a.internal.active=!1),t8.updateContainer(null,r,null,()=>{a&&setTimeout(()=>{try{null==a.events.disconnect||a.events.disconnect(),null==(t=a.gl)||null==(r=t.renderLists)||null==r.dispose||r.dispose(),null==(i=a.gl)||null==i.forceContextLoss||i.forceContextLoss(),null!=(o=a.gl)&&o.xr&&a.xr.disconnect();var t,r,i,o,l=a.scene;for(let e in"Scene"!==l.type&&(null==l.dispose||l.dispose()),l){let n=l[e];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}t9.delete(e),n&&n(e)}catch(e){}},500)})}}function rr(e,n){let t={callback:e};return n.add(t),()=>void n.delete(t)}let ra=new Set,ri=new Set,ro=new Set,rl=e=>rr(e,ra),rs=e=>rr(e,ri);function ru(e,n){if(e.size)for(let{callback:t}of e.values())t(n)}function rc(e,n){switch(e){case"before":return ru(ra,n);case"after":return ru(ri,n);case"tail":return ru(ro,n)}}function rd(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),n=r.internal.subscribers;for(let e=0;e0)&&!(null!=(n=i.gl.xr)&&n.isPresenting)&&(r+=rd(e,i))}if(rp=!1,rc("after",e),0===r)return rc("tail",e),rf=!1,cancelAnimationFrame(a)}function rh(e,n=1){var t;if(!e)return t9.forEach(e=>rh(e.store.getState(),n));(null==(t=e.gl.xr)||!t.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(n>1?e.internal.frames=Math.min(60,e.internal.frames+n):rp?e.internal.frames=2:e.internal.frames=1,rf||(rf=!0,requestAnimationFrame(rm)))}function rg(e,n=!0,t,r){if(n&&rc("before",e),t)rd(e,t,r);else for(let n of t9.values())rd(e,n.store.getState());n&&rc("after",e)}let r_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rv(e){let{handlePointer:n}=function(e){function n(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(n=>{var t;return null==(t=e.__r3f)?void 0:t.handlers["onPointer"+n]}))}function t(n){let{internal:t}=e.getState();for(let e of t.hovered.values())if(!n.length||!n.find(n=>n.object===e.object&&n.index===e.index&&n.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(t.hovered.delete(tI(e)),null!=r&&r.eventCount){let t=r.handlers,a={...e,intersections:n};null==t.onPointerOut||t.onPointerOut(a),null==t.onPointerLeave||t.onPointerLeave(a)}}}function r(e,n){for(let t=0;tt([]);case"onLostPointerCapture":return n=>{let{internal:r}=e.getState();"pointerId"in n&&r.capturedMap.has(n.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(n.pointerId)&&(r.capturedMap.delete(n.pointerId),t([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(n,t){let r=e.getState(),a=new Set,i=[],o=t?t(r.internal.interaction):r.internal.interaction;for(let e=0;e{let t=tE(e.object),r=tE(n.object);return t&&r&&r.events.priority-t.events.priority||e.distance-n.distance}).filter(e=>{let n=tI(e);return!a.has(n)&&(a.add(n),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let n=e.object;for(;n;){var s;null!=(s=n.__r3f)&&s.eventCount&&i.push({...e,eventObject:n}),n=n.parent}}if("pointerId"in n&&r.internal.capturedMap.has(n.pointerId))for(let e of r.internal.capturedMap.get(n.pointerId).values())a.has(tI(e.intersection))||i.push(e.intersection);return i}(i,s?n:void 0),d=u?function(n){let{internal:t}=e.getState(),r=n.offsetX-t.initialClick[0],a=n.offsetY-t.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&t(c),!function(e,n,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=tE(o.object);if(l||o.object.traverseAncestors(e=>{let n=tE(e);if(n)return l=n,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new h.Vector3(u.x,u.y,0).unproject(c),p=e=>{var n,t;return null!=(n=null==(t=d.capturedMap.get(e))?void 0:t.has(o.eventObject))&&n},m=e=>{let t={intersection:o,target:n.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,t):d.capturedMap.set(e,new Map([[o.eventObject,t]])),n.target.setPointerCapture(e)},g=e=>{let n=d.capturedMap.get(e);n&&tF(d.capturedMap,o.eventObject,n,e)},_={};for(let e in n){let t=n[e];"function"!=typeof t&&(_[e]=t)}let v={...o,..._,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in n&&d.capturedMap.get(n.pointerId);(!r||r.has(o.eventObject))&&(v.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&t([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:g},nativeEvent:n};if(a(v),!0===i.stopped)break}}}}(c,i,d,function(e){let n=e.eventObject,t=n.__r3f;if(!(null!=t&&t.eventCount))return;let o=t.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let n=tI(e),t=l.hovered.get(n);t?t.stopped&&e.stopPropagation():(l.hovered.set(n,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let t=o[a];t?(!u||l.initialHits.includes(n))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),t(e)):u&&l.initialHits.includes(n)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,n,t){n.pointer.set(e.offsetX/n.size.width*2-1,-(2*(e.offsetY/n.size.height))+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(r_).reduce((e,t)=>({...e,[t]:n(t)}),{}),update:()=>{var n;let{events:t,internal:r}=e.getState();null!=(n=r.lastEvent)&&n.current&&t.handlers&&t.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{let{set:t,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),t(e=>({events:{...e.events,connected:n}})),r.handlers)for(let e in r.handlers){let t=r.handlers[e],[a,i]=r_[e];n.addEventListener(a,t,{passive:i})}},disconnect:()=>{let{set:n,events:t}=e.getState();if(t.connected){if(t.handlers)for(let e in t.handlers){let n=t.handlers[e],[r]=r_[e];t.connected.removeEventListener(r,n)}n(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>t_,"C",()=>tk,"D",()=>tH,"E",()=>tv,"G",()=>tW,"a",()=>th,"b",()=>tm,"c",()=>re,"d",()=>rt,"e",()=>tK,"f",()=>rv,"i",()=>tf,"j",()=>rl,"k",()=>rs,"u",()=>tg],91037)},49774,e=>{"use strict";var n=e.i(91037);e.s(["useFrame",()=>n.D])},73949,e=>{"use strict";var n=e.i(91037);e.s(["useThree",()=>n.C])},79123,e=>{"use strict";var n=e.i(43476),t=e.i(71645);let r=(0,t.createContext)(null),a=(0,t.createContext)(null),i=(0,t.createContext)(null);function o(){return(0,t.useContext)(r)}function l(){return(0,t.useContext)(a)}function s(){return(0,t.useContext)(i)}function u({children:e,fogEnabledOverride:o,onClearFogEnabledOverride:l}){let[s,u]=(0,t.useState)(!0),[c,d]=(0,t.useState)(!1),[f,p]=(0,t.useState)(1),[m,h]=(0,t.useState)(90),[g,_]=(0,t.useState)(!1),[v,S]=(0,t.useState)(!0),[E,T]=(0,t.useState)(!1),[b,M]=(0,t.useState)("moveLookStick"),x=(0,t.useCallback)(e=>{u(e),l()},[l]),R=(0,t.useMemo)(()=>({fogEnabled:o??s,setFogEnabled:x,highQualityFog:c,setHighQualityFog:d,fov:m,setFov:h,audioEnabled:g,setAudioEnabled:_,animationEnabled:v,setAnimationEnabled:S}),[s,o,x,c,m,g,v]),C=(0,t.useMemo)(()=>({debugMode:E,setDebugMode:T}),[E,T]),y=(0,t.useMemo)(()=>({speedMultiplier:f,setSpeedMultiplier:p,touchMode:b,setTouchMode:M}),[f,p,b,M]);(0,t.useLayoutEffect)(()=>{let e={};try{e=JSON.parse(localStorage.getItem("settings"))||{}}catch(e){}null!=e.debugMode&&T(e.debugMode),null!=e.audioEnabled&&_(e.audioEnabled),null!=e.animationEnabled&&S(e.animationEnabled),null!=e.fogEnabled&&u(e.fogEnabled),null!=e.highQualityFog&&d(e.highQualityFog),null!=e.speedMultiplier&&p(e.speedMultiplier),null!=e.fov&&h(e.fov),null!=e.touchMode&&M(e.touchMode)},[]);let A=(0,t.useRef)(null);return(0,t.useEffect)(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{try{localStorage.setItem("settings",JSON.stringify({fogEnabled:s,highQualityFog:c,speedMultiplier:f,fov:m,audioEnabled:g,animationEnabled:v,debugMode:E,touchMode:b}))}catch(e){}},500),()=>{A.current&&clearTimeout(A.current)}),[s,c,f,m,g,v,E,b]),(0,n.jsx)(r.Provider,{value:R,children:(0,n.jsx)(a.Provider,{value:C,children:(0,n.jsx)(i.Provider,{value:y,children:e})})})}e.s(["SettingsProvider",()=>u,"useControls",()=>s,"useDebug",()=>l,"useSettings",()=>o])}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/284925ee1f24c201.css b/docs/_next/static/chunks/284925ee1f24c201.css deleted file mode 100644 index b20560df..00000000 --- a/docs/_next/static/chunks/284925ee1f24c201.css +++ /dev/null @@ -1 +0,0 @@ -html{box-sizing:border-box;background:#000;margin:0;padding:0;overflow:hidden}*,:before,:after{box-sizing:inherit}body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:100%}body{margin:0;padding:0;overflow:hidden}main{width:100dvw;height:100dvh}#canvasContainer{z-index:0;position:absolute;inset:0}#controls{color:#fff;z-index:2;background:#00000080;border-radius:0 0 4px;padding:8px 12px 8px 8px;font-size:13px;position:fixed;top:0;left:0}input[type=range]{max-width:80px}.CheckboxField,.LabelledButton,.Field{align-items:center;gap:6px;display:flex}#controls,.Controls-dropdown,.Controls-group{justify-content:center;align-items:center;gap:20px;display:flex}@media (max-width:1279px){.Controls-dropdown[data-open=false]{display:none}.Controls-dropdown{background:#000c;border:1px solid #fff3;border-radius:4px;flex-direction:column;align-items:center;gap:12px;max-height:calc(100dvh - 56px);padding:12px;display:flex;position:absolute;top:calc(100% + 2px);left:2px;right:2px;overflow:auto;box-shadow:0 0 12px #0006}.Controls-group{flex-wrap:wrap;gap:12px 20px}}@media (max-width:639px){#controls{border-radius:0;right:0}#controls>.MissionSelect-inputWrapper{flex:1 1 0;min-width:0}#controls>.MissionSelect-inputWrapper .MissionSelect-input{width:100%}.Controls-toggle{flex:none}}.IconButton{color:#fff;cursor:pointer;background:#03529399;border:1px solid #c8c8c84d;border-color:#ffffff4d #c8c8c84d #c8c8c84d #ffffff4d;border-radius:4px;justify-content:center;align-items:center;width:28px;height:28px;margin:0 0 0 -12px;padding:0;font-size:15px;transition:background .2s,border-color .2s;display:flex;position:relative;transform:translate(0);box-shadow:0 1px 2px #0006}.ButtonLabel{font-size:12px}.IconButton svg{pointer-events:none}@media (hover:hover){.IconButton:hover{background:#0062b3cc;border-color:#fff6}}.IconButton:active,.IconButton[aria-expanded=true]{background:#0062b3b3;border-color:#ffffff4d;transform:translateY(1px)}.Controls-toggle{margin:0}@media (max-width:1279px){.LabelledButton{width:auto;padding:0 10px}}@media (min-width:1280px){.Controls-toggle,.LabelledButton .ButtonLabel,.MapInfoButton{display:none}}.CopyCoordinatesButton[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton .ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton[data-copied=true] .ClipboardCheck{animation:.22s linear infinite showClipboardCheck;display:block}.CopyCoordinatesButton[data-copied=true] .MapPin{display:none}.StaticShapeLabel{color:#fff;white-space:nowrap;text-align:center;background:#00000080;border-radius:1px;padding:1px 3px;font-size:11px}.StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.AxisLabel{pointer-events:none;font-size:12px}.AxisLabel[data-axis=x]{color:#f90}.AxisLabel[data-axis=y]{color:#9f0}.AxisLabel[data-axis=z]{color:#09f}.MissionSelect-inputWrapper{align-items:center;display:flex;position:relative}.MissionSelect-shortcut{color:#fff9;pointer-events:none;background:#ffffff26;border-radius:3px;padding:1px 4px;font-family:system-ui,sans-serif;font-size:11px;position:absolute;right:7px}.MissionSelect-input[aria-expanded=true]~.MissionSelect-shortcut{display:none}.MissionSelect-input{color:#fff;-webkit-user-select:text;user-select:text;background:#0009;border:1px solid #ffffff4d;border-radius:3px;outline:none;width:280px;padding:6px 36px 6px 8px;font-size:14px}.MissionSelect-input[aria-expanded=true]{padding-right:8px}.MissionSelect-input:focus{border-color:#fff9}.MissionSelect-input::placeholder{color:#0000}.MissionSelect-selectedValue{pointer-events:none;align-items:center;gap:6px;display:flex;position:absolute;left:8px;right:36px;overflow:hidden}.MissionSelect-input[aria-expanded=true]~.MissionSelect-selectedValue{display:none}.MissionSelect-selectedName{color:#fff;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.MissionSelect-selectedValue>.MissionSelect-itemType{flex-shrink:0}.MissionSelect-popover{z-index:100;min-width:320px;max-height:var(--popover-available-height,90vh);overscroll-behavior:contain;background:#141414f2;border:1px solid #ffffff80;border-radius:3px;overflow-y:auto;box-shadow:0 8px 24px #0009}.MissionSelect-list{padding:4px 0}.MissionSelect-list:has(>.MissionSelect-group:first-child){padding-top:0}.MissionSelect-group{padding-bottom:4px}.MissionSelect-groupLabel{color:#c6caca;z-index:1;background:#3a4548f2;border-bottom:1px solid #ffffff4d;padding:6px 8px 6px 12px;font-size:13px;font-weight:600;position:sticky;top:0}.MissionSelect-group:not(:last-child){border-bottom:1px solid #ffffff4d}.MissionSelect-item{cursor:pointer;border-radius:4px;outline:none;flex-direction:column;gap:1px;margin:4px 4px 0;padding:6px 8px;scroll-margin-top:32px;display:flex}.MissionSelect-list>.MissionSelect-item:first-child{margin-top:0}.MissionSelect-item[data-active-item]{background:#ffffff26}.MissionSelect-item[aria-selected=true]{background:#6496ff4d}.MissionSelect-itemHeader{align-items:center;gap:6px;display:flex}.MissionSelect-itemName{color:#fff;font-size:14px;font-weight:600}.MissionSelect-itemTypes{gap:3px;display:flex}.MissionSelect-itemType{color:#fff;background:#ff9d0066;border-radius:3px;padding:2px 5px;font-size:10px;font-weight:600}.MissionSelect-itemType:hover{background:#ff9d00b3}.MissionSelect-itemMissionName{color:#ffffff80;font-size:12px}.MissionSelect-noResults{color:#ffffff80;text-align:center;padding:12px 8px;font-size:13px}.LoadingSpinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite LoadingSpinner-spin}@keyframes LoadingSpinner-spin{to{transform:rotate(360deg)}}#loadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#loadingIndicator[data-complete=true]{animation:.3s ease-out forwards loadingComplete}@keyframes loadingComplete{0%{opacity:1}to{opacity:0}}.LoadingProgress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.LoadingProgress-bar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.LoadingProgress-text{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes showClipboardCheck{0%{opacity:1}to{opacity:.2}}.KeyboardOverlay{pointer-events:none;z-index:1;align-items:flex-end;gap:10px;display:flex;position:fixed;bottom:16px;left:50%;transform:translate(-50%)}.KeyboardOverlay-column{flex-direction:column;justify-content:center;gap:4px;display:flex}.KeyboardOverlay-row{justify-content:stretch;gap:4px;display:flex}.KeyboardOverlay-spacer{width:32px}.KeyboardOverlay-key{color:#ffffff80;white-space:nowrap;background:#0006;border:1px solid #fff3;border-radius:4px;flex:1 0 0;justify-content:center;align-items:center;min-width:32px;height:32px;padding:0 8px;font-size:11px;font-weight:600;display:flex}.KeyboardOverlay-key[data-pressed=true]{color:#fff;background:#34bbab99;border-color:#23fddc80}.KeyboardOverlay-arrow{margin-right:3px}.TouchJoystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchJoystick--left{left:20px;transform:none}.TouchJoystick--right{left:auto;right:20px;transform:none}.TouchJoystick .back{background:#034f4c99!important;border:1px solid #00dbdf80!important;box-shadow:inset 0 0 10px #000000b3!important}.TouchJoystick .front{background:radial-gradient(circle,#17f7c6e6 0%,#09b8aaf2 100%)!important;border:2px solid #fff6!important;box-shadow:0 2px 4px #00000080,0 1px 1px #0000004d,inset 0 1px #ffffff26,inset 0 -1px 2px #0000004d!important} diff --git a/docs/_next/static/chunks/fcdc907286f09d63.js b/docs/_next/static/chunks/39f1afbfab5559a9.js similarity index 86% rename from docs/_next/static/chunks/fcdc907286f09d63.js rename to docs/_next/static/chunks/39f1afbfab5559a9.js index bf200306..7d4a905c 100644 --- a/docs/_next/static/chunks/fcdc907286f09d63.js +++ b/docs/_next/static/chunks/39f1afbfab5559a9.js @@ -33,7 +33,7 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(he.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i0)for(let r=e;r=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x=s.x&&s.x>=h&&r!==s.x&&rW(ni.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;ne&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;rr3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t0)&&p.push(e,r,h),(t!==i-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t=r)){let a=e[1];t=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;let i=nq[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n,o=0;return new Response(new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s1){let t=!1,e=0;for(let t=0,e=c.length;tNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"undefined"!=typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},53487,(t,e,i)=>{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}t.s(["getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};ieS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew{"use strict";var e=t.i(90072);t.s(["parse",()=>C,"runServer",()=>T],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)} + `},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;st.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t0){let i,s;for(i=1,s=e.length;i0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;ee).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;tt.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;ts)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(he.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;tr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i0)for(let r=e;r=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x=s.x&&s.x>=h&&r!==s.x&&rW(ni.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;ne&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;rr3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;iNumber.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t0)&&p.push(e,r,h),(t!==i-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t=s)){h.push(e.times[t]);for(let i=0;in.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t=r)){let a=e[1];t=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i>>1;te;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;let i=nq[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n,o=0;return new Response(new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s1)for(let i=0;i.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s1){let t=!1,e=0;for(let t=0,e=c.length;tNumber.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;te?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"undefined"!=typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},53487,(t,e,i)=>{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}let m=new Map(Object.keys(r.missions).map(t=>[t.toLowerCase(),t]));function f(t){let e=t.replace(/-/g,"_").toLowerCase();return m.get(e)??null}t.s(["findMissionByDemoName",()=>f,"getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};ieS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew{"use strict";var e=t.i(90072);t.s(["parse",()=>E,"runServer",()=>N],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)} ${r} ${this.line("});")}`}{let e=t.name.name;this.currentFunction=e.toLowerCase();let i=this.functionBody(t.body,t.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(e)}, function() {`)} ${i} @@ -49,4 +49,4 @@ ${this.line("}")}`}switchCase(t){let e=[];if(null===t.test)e.push(this.line("def ${e} ${this.line("}")}`}statementAsBlock(t){if("BlockStatement"===t.type)return this.blockStatement(t);this.indentLevel++;let e=this.statement(t);return this.indentLevel--,`{ ${e} -${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>A,"createScriptCache",()=>v],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;se&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;ne().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return is)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return is)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(){return{scripts:new Map,generatedCode:new WeakMap}}function w(t){return t.toLowerCase()}function M(t){return Number(t)>>>0}function S(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function A(t={}){let e=new o,i=new o,s=new o,r=[],u=new h,c=3,p=1027,d=new Map,m=new o,f=new o,g=new o,y=new o,x=new o;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);g.set(e.slice(1),i)}let _=new Set,T=new Set,I=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,z=t.cache??v(),k=z.scripts,B=z.generatedCode,R=new Map;function O(t){let e=R.get(t);return e&&e.length>0?e[e.length-1]:void 0}function E(t,e,i){let s;(s=R.get(t))||(s=[],R.set(t,s)),s.push(e);try{return i()}finally{let e;(e=R.get(t))&&e.pop()}}function P(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function L(t,i){return e.get(t)?.get(i)??null}let N=new Set,F=null,$=null,V=(t.builtins??b)({runtime:()=>$,fileSystem:t.fileSystem??null});function D(t){let n=s.get(t);if(!n)return void u.add(t);if(!n.active){for(let[t,i]of(n.active=!0,r.push(n.name),n.methods)){e.has(t)||e.set(t,new o);let s=e.get(t);for(let[t,e]of i)s.has(t)||s.set(t,[]),s.get(t).push(e)}for(let[t,e]of n.functions)i.has(t)||i.set(t,[]),i.get(t).push(e)}}function j(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?m.get(t)??null:"number"==typeof t?d.get(t)??null:null}function U(t,e,i){let s=j(t);if(null==s)return 0;let r=H(s[e]);return s[e]=r+i,r}function W(t,e){let i=L(t,e);return i&&i.length>0?i[i.length-1]:null}function G(t,e,i,s){let r=L(t,e);return r&&0!==r.length?{found:!0,result:E(P(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function q(t,e,i,s){let r=y.get(t);if(r){let t=r.get(e);if(t)for(let e of t)e(i,...s)}}function H(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function J(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;te._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function X(t){return null==t||""===t?null:J(String(t))}function Z(t){function e(t,e){return t+e.join("_")}return{get:(i,...s)=>t.get(e(i,s))??"",set(i,...s){if(0===s.length)throw Error("set() requires at least a value argument");if(1===s.length)return t.set(i,s[0]),s[0];let r=s[s.length-1],n=s.slice(0,-1);return t.set(e(i,n),r),r},postInc(i,...s){let r=e(i,s),n=H(t.get(r));return t.set(r,n+1),n},postDec(i,...s){let r=e(i,s),n=H(t.get(r));return t.set(r,n-1),n}}}function Y(){return Z(new o)}let Q={registerMethod:function(t,i,s){if(F)F.methods.has(t)||F.methods.set(t,new o),F.methods.get(t).set(i,s);else{e.has(t)||e.set(t,new o);let r=e.get(t);r.has(i)||r.set(i,[]),r.get(i).push(s)}},registerFunction:function(t,e){F?F.functions.set(t,e):(i.has(t)||i.set(t,[]),i.get(t).push(e))},package:function(t,e){let i=s.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},s.set(t,i));let r=F;F=i,e(),F=r,u.has(t)&&(u.delete(t),D(t))},activatePackage:D,deactivatePackage:function(t){let n=s.get(t);if(!n||!n.active)return;n.active=!1;let a=r.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,i]of(-1!==a&&r.splice(a,1),n.methods)){let s=e.get(t);if(s)for(let[t,e]of i){let i=s.get(t);if(i){let t=i.indexOf(e);-1!==t&&i.splice(t,1)}}}for(let[t,e]of n.functions){let s=i.get(t);if(s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}},create:function(t,e,i,s){let r=w(t),n=p++,a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[w(t)]=e;a.superclass&&(a._superClass=w(String(a.superclass)),a.class&&x.set(w(String(a.class)),a._superClass)),d.set(n,a);let o=S(e);if(o&&(a._name=o,m.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=W(t,"onAdd");return h&&h(a),a},datablock:function(t,e,i,s){let r=w(t),n=c++,a={_class:r,_className:t,_id:n,_isDatablock:!0},o=S(i);if(o){let t=f.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[w(t)]=e;d.set(n,a);let h=S(e);return h&&(a._name=h,m.set(h,a),f.set(h,a)),a},deleteObject:function t(e){let i;if(null==e||("number"==typeof e?i=d.get(e):"string"==typeof e?i=m.get(e):"object"==typeof e&&e._id&&(i=e),!i))return!1;let s=W(i._className,"onRemove");if(s&&s(i),d.delete(i._id),i._name&&m.delete(i._name),i._isDatablock&&i._name&&f.delete(i._name),i._parent&&i._parent._children){let t=i._parent._children.indexOf(i);-1!==t&&i._parent._children.splice(t,1)}if(i._children)for(let e of[...i._children])t(e);return!0},prop:function(t,e){let i=j(t);return null==i?"":i[w(e)]??""},setProp:function(t,e,i){let s=j(t);return null==s||(s[w(e)]=i),i},getIndex:function(t,e){let i=j(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=j(t);return null==s||(s[String(e)]=i),i},propPostInc:function(t,e){return U(t,w(e),1)},propPostDec:function(t,e){return U(t,w(e),-1)},indexPostInc:function(t,e){return U(t,String(e),1)},indexPostDec:function(t,e){return U(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=X(t)))return"";let s=t.class||t._className||t._class;if(s){let r=G(s,e,t,i);if(r.found)return q(s,e,t,i),r.result}let r=t._superClass||x.get(s);for(;r;){let s=G(r,e,t,i);if(s.found)return q(r,e,t,i),s.result;r=x.get(r)}return""},nsCall:function(t,e,...i){let s=L(t,e);if(!s||0===s.length)return"";let r=P(t,e),n=s[s.length-1],a=E(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&q(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=L(t,e);if(!i||0===i.length)return null;let s=P(t,e),r=i[i.length-1];return(...t)=>E(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=L(t,e),n=P(t,e),a=O(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=E(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&q(t,e,i,s),h}let o=x.get(t);for(;o;){let t=L(o,e);if(t&&t.length>0){let r=E(P(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&q(o,e,i,s),r}o=x.get(o)}return""},parentFunc:function(t,...e){let s=i.get(t);if(!s)return"";let r=t.toLowerCase(),n=O(r);if(void 0===n||n<1)return"";let a=n-1;return E(r,a,()=>s[a](...e))},add:function(t,e){return H(t)+H(e)},sub:function(t,e){return H(t)-H(e)},mul:function(t,e){return H(t)*H(e)},div:function(t,e){return H(t)/H(e)},neg:function(t){return-H(t)},lt:function(t,e){return H(t)H(e)},ge:function(t,e){return H(t)>=H(e)},eq:function(t,e){return H(t)===H(e)},ne:function(t,e){return H(t)!==H(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return M(t)&M(e)},bitor:function(t,e){return M(t)|M(e)},bitxor:function(t,e){return M(t)^M(e)},shl:function(t,e){return M(M(t)<<(31&M(e)))},shr:function(t,e){return M(t)>>>(31&M(e))},bitnot:function(t){return~M(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&w(t)===i)return void s();e.default&&e.default()},deref:X,nameToId:function(t){let e=J(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?d.has(t):"string"==typeof t&&m.has(t)))},isFunction:function(t){return i.has(t)||t.toLowerCase()in V},isPackage:function(t){return s.has(t)},isActivePackage:function(t){let e=s.get(t);return e?.active??!1},getPackageList:function(){return r.join(" ")},locals:Y,onMethodCalled(t,e,i){let s=y.get(t);s||(s=new o,y.set(t,s));let r=s.get(e);r||(r=[],s.set(e,r)),r.push(i)}},K={call(t,...e){let s=i.get(t);if(s&&s.length>0)return E(t.toLowerCase(),s.length-1,()=>s[s.length-1](...e));let r=V[t.toLowerCase()];return r?r(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tt=Z(g),te={methods:e,functions:i,packages:s,activePackages:r,objectsById:d,objectsByName:m,datablocks:f,globals:g,executedScripts:_,failedScripts:T,scripts:k,generatedCode:B,pendingTimeouts:N,startTime:Date.now()};function ti(t){let e=function(t){let e=B.get(t);null==e&&(e=new n(void 0).generate(t),B.set(t,e));return e}(t),i=Y();Function("$","$f","$g","$l",e)(Q,K,tt,i)}function ts(t,e){return{execute(){if(e){let t=l(e);te.executedScripts.add(t)}ti(t)}}}async function tr(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(te.scripts.has(n)||te.failedScripts.has(n))return;if(I&&I(n)){console.warn(`Ignoring script: ${e}`),te.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),te.failedScripts.add(n),t.progress?.completeItem();return}try{a=C(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),te.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tr(a.execScriptPaths,i,h),te.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tn(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(te.scripts.has(s))return ts(te.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await ta(r,{path:e});return t.progress?.completeItem(),n}async function ta(t,e){if(e?.path){let t=l(e.path);if(te.scripts.has(t))return ts(te.scripts.get(t),e.path)}return to(C(t,{filename:e?.path}),e)}async function to(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);te.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tr(n,s,r),ts(e,i?.path)}return $={$:Q,$f:K,$g:tt,state:te,destroy:function(){for(let t of te.pendingTimeouts)clearTimeout(t);te.pendingTimeouts.clear()},executeAST:ti,loadFromPath:tn,loadFromSource:ta,loadFromAST:to,call:(t,...e)=>K.call(t,...e),getObjectByName:t=>m.get(t)}}function _(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function C(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function T(t){let{missionName:e,missionType:i,runtimeOptions:s,onMissionLoadDone:r}=t,{signal:n,fileSystem:a,globals:o={},preloadScripts:h=[]}=s??{},l=a.findFiles("scripts/*Game.cs"),u=A({...s,globals:{...o,"$Host::Map":e,"$Host::MissionType":i},preloadScripts:[...h,...l]}),c=async function(){try{let t=await u.loadFromPath("scripts/server.cs");n?.throwIfAborted(),await u.loadFromPath(`missions/${e}.mis`),n?.throwIfAborted(),t.execute(),r&&u.$.onMethodCalled("DefaultGame","missionLoadDone",r);let i=await u.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");n?.throwIfAborted(),i.execute()}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:u,ready:c}}t.s(["createProgressTracker",()=>_],38433);let I=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,z=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,k=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,B={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function R(t){let e=C(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match(z))?{type:"sectionBegin",name:e[1]}:(e=t.match(k))?{type:"sectionEnd",name:e[1]}:(e=t.match(I))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>B[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function O(t,e){if(t)return t[e.toLowerCase()]}function E(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function P(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function L(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function N(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function F(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>E,"getInt",()=>P,"getPosition",()=>L,"getProperty",()=>O,"getRotation",()=>F,"getScale",()=>N,"parseMissionScript",()=>R],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("�","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); \ No newline at end of file +${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>R,"createScriptCache",()=>I],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;se&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;ne().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return is)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return is)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(t){return t.toLowerCase()}function w(t){let e=t.trim();return v(e.startsWith("$")?e.slice(1):e)}function M(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function S(t,e){for(let i of e)t.add(v(i))}function A(t,e,i){if(t.anyClassValues.has("*")||t.anyClassValues.has(i))return!0;for(let s of e){let e=t.valuesByClass.get(v(s));if(e&&(e.has("*")||e.has(i)))return!0}return!1}let _=[{classNames:["SceneObject","GameBase","ShapeBase","Item","Player"],fields:["position","rotation","scale","transform","hidden","renderingdistance","datablock","shapename","shapefile","initialbarrel","skin","team","health","energy","energylevel","damagelevel","damageflash","damagepercent","damagestate","mountobject","mountedimage","targetposition","targetrotation","targetscale","missiontypeslist","renderenabled","vis","velocity","name"]},{classNames:["*"],fields:["position","rotation","scale","hidden","shapefile","datablock"]}],C=[{classNames:["SceneObject","GameBase","ShapeBase","SimObject"],methods:["settransform","setposition","setrotation","setscale","sethidden","setdatablock","setshapename","mountimage","unmountimage","mountobject","unmountobject","setdamagelevel","setenergylevel","schedule","delete","deleteallobjects","add","remove"]},{classNames:["*"],methods:["settransform","setscale","delete","add","remove"]}],T=["missionrunning","loadingmission"];function I(){return{scripts:new Map,generatedCode:new WeakMap}}function z(t){return t.toLowerCase()}function k(t){return Number(t)>>>0}function B(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function R(t={}){let e,i,s,r=t.reactiveFieldRules??_,u=t.reactiveMethodRules??C,c=t.reactiveGlobalNames??T,p=(e=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.fields);continue}S(M(i,r),s.fields)}return{anyClassValues:e,valuesByClass:i}}(r),(t,i)=>A(e,t,v(i))),d=(i=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.methods);continue}S(M(i,r),s.methods)}return{anyClassValues:e,valuesByClass:i}}(u),(t,e)=>A(i,t,v(e))),m=(s=function(t){let e=new Set;for(let i of t)e.add(w(i));return e}(c),t=>{let e=w(t);return s.has("*")||s.has(e)}),f=new o,g=new o,y=new o,x=[],O=new h,P=3,L=1027,N=new Map,F=new o,$=new o,V=new o,D=new o,j=new o,U=new Set,W=[],G=!1,q=0;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);V.set(e.slice(1),i)}let H=new Set,J=new Set,X=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,Z=t.cache??I(),Y=Z.scripts,Q=Z.generatedCode,K=new Map;function tt(t){let e=K.get(t);return e&&e.length>0?e[e.length-1]:void 0}function te(t,e,i){let s;(s=K.get(t))||(s=[],K.set(t,s)),s.push(e);try{return i()}finally{let e;(e=K.get(t))&&e.pop()}}function ti(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function ts(t,e){return f.get(t)?.get(e)??null}function tr(t){if(!t)return[];let e=[],i=new Set,s=t.class||t._className||t._class,r=s?z(String(s)):"";for(;r&&!i.has(r);)e.push(r),i.add(r),r=j.get(r)??"";return t._superClass&&!i.has(t._superClass)&&e.push(t._superClass),e}function tn(){if(G=!1,0===W.length)return;let t=W.splice(0,W.length);for(let e of(q+=1,U))e({type:"batch.flushed",tick:q,events:t})}function ta(t){for(let e of(W.push(t),U))e(t);G||(G=!0,queueMicrotask(tn))}function to(t){ta({type:"object.created",objectId:t._id,object:t})}function th(t,e,i,s){let r=z(e);Object.is(i,s)||p(tr(t),r)&&ta({type:"field.changed",objectId:t._id,field:r,value:i,previousValue:s,object:t})}let tl=new Set,tu=null,tc=null,tp=(t.builtins??b)({runtime:()=>tc,fileSystem:t.fileSystem??null});function td(t){let e=y.get(t);if(!e)return void O.add(t);if(!e.active){for(let[t,i]of(e.active=!0,x.push(e.name),e.methods)){f.has(t)||f.set(t,new o);let e=f.get(t);for(let[t,s]of i)e.has(t)||e.set(t,[]),e.get(t).push(s)}for(let[t,i]of e.functions)g.has(t)||g.set(t,[]),g.get(t).push(i)}}function tm(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?F.get(t)??null:"number"==typeof t?N.get(t)??null:null}function tf(t,e,i){let s=tm(t);if(null==s)return 0;let r=tb(s[e]);return s[e]=r+i,th(s,e,s[e],r),r}function tg(t,e){let i=ts(t,e);return i&&i.length>0?i[i.length-1]:null}function ty(t,e,i,s){let r=ts(t,e);return r&&0!==r.length?{found:!0,result:te(ti(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function tx(t,e,i,s){let r;d((r=tr(i)).length?r:[t],e)&&ta({type:"method.called",className:z(t),methodName:z(e),objectId:i._id,args:[...s]});let n=D.get(t);if(n){let t=n.get(e);if(t)for(let e of t)e(i,...s)}}function tb(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function tv(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;te._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function tw(t){return null==t||""===t?null:tv(String(t))}function tM(t,e){function i(t,e){return t+e.join("_")}return{get:(e,...s)=>t.get(i(e,s))??"",set(s,...r){if(0===r.length)throw Error("set() requires at least a value argument");if(1===r.length){let i=t.get(s);return t.set(s,r[0]),e?.onSet?.(s,r[0],i),r[0]}let n=r[r.length-1],a=i(s,r.slice(0,-1)),o=t.get(a);return t.set(a,n),e?.onSet?.(a,n,o),n},postInc(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a+1;return t.set(n,o),e?.onSet?.(n,o,a),a},postDec(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a-1;return t.set(n,o),e?.onSet?.(n,o,a),a}}}function tS(){return tM(new o)}let tA={registerMethod:function(t,e,i){if(tu)tu.methods.has(t)||tu.methods.set(t,new o),tu.methods.get(t).set(e,i);else{f.has(t)||f.set(t,new o);let s=f.get(t);s.has(e)||s.set(e,[]),s.get(e).push(i)}},registerFunction:function(t,e){tu?tu.functions.set(t,e):(g.has(t)||g.set(t,[]),g.get(t).push(e))},package:function(t,e){let i=y.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},y.set(t,i));let s=tu;tu=i,e(),tu=s,O.has(t)&&(O.delete(t),td(t))},activatePackage:td,deactivatePackage:function(t){let e=y.get(t);if(!e||!e.active)return;e.active=!1;let i=x.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,s]of(-1!==i&&x.splice(i,1),e.methods)){let e=f.get(t);if(e)for(let[t,i]of s){let s=e.get(t);if(s){let t=s.indexOf(i);-1!==t&&s.splice(t,1)}}}for(let[t,i]of e.functions){let e=g.get(t);if(e){let t=e.indexOf(i);-1!==t&&e.splice(t,1)}}},create:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(L);)L+=1;let t=L;return L+=1,t}(),a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[z(t)]=e;a.superclass&&(a._superClass=z(String(a.superclass)),a.class&&j.set(z(String(a.class)),a._superClass)),N.set(n,a);let o=B(e);if(o&&(a._name=o,F.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=tg(t,"onAdd");return h&&h(a),to(a),a},datablock:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(P);)P+=1;let t=P;return P+=1,t}(),a={_class:r,_className:t,_id:n,_isDatablock:!0},o=B(i);if(o){let t=$.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[z(t)]=e;N.set(n,a);let h=B(e);return h&&(a._name=h,F.set(h,a),$.set(h,a)),to(a),a},deleteObject:function t(e){var i;let s;if(null==e||("number"==typeof e?s=N.get(e):"string"==typeof e?s=F.get(e):"object"==typeof e&&e._id&&(s=e),!s))return!1;let r=tg(s._className,"onRemove");if(r&&r(s),N.delete(s._id),s._name&&F.delete(s._name),s._isDatablock&&s._name&&$.delete(s._name),s._parent&&s._parent._children){let t=s._parent._children.indexOf(s);-1!==t&&s._parent._children.splice(t,1)}if(s._children)for(let e of[...s._children])t(e);return ta({type:"object.deleted",objectId:(i=s)._id,object:i}),!0},prop:function(t,e){let i=tm(t);return null==i?"":i[z(e)]??""},setProp:function(t,e,i){let s=tm(t);if(null==s)return i;let r=z(e),n=s[r];return s[r]=i,th(s,r,i,n),i},getIndex:function(t,e){let i=tm(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=tm(t);if(null==s)return i;let r=String(e),n=s[r];return s[r]=i,th(s,r,i,n),i},propPostInc:function(t,e){return tf(t,z(e),1)},propPostDec:function(t,e){return tf(t,z(e),-1)},indexPostInc:function(t,e){return tf(t,String(e),1)},indexPostDec:function(t,e){return tf(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=tw(t)))return"";let s=t.class||t._className||t._class;if(s){let r=ty(s,e,t,i);if(r.found)return tx(s,e,t,i),r.result}let r=t._superClass||j.get(s);for(;r;){let s=ty(r,e,t,i);if(s.found)return tx(r,e,t,i),s.result;r=j.get(r)}return""},nsCall:function(t,e,...i){let s=ts(t,e);if(!s||0===s.length)return"";let r=ti(t,e),n=s[s.length-1],a=te(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&tx(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=ts(t,e);if(!i||0===i.length)return null;let s=ti(t,e),r=i[i.length-1];return(...t)=>te(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=ts(t,e),n=ti(t,e),a=tt(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=te(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&tx(t,e,i,s),h}let o=j.get(t);for(;o;){let t=ts(o,e);if(t&&t.length>0){let r=te(ti(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&tx(o,e,i,s),r}o=j.get(o)}return""},parentFunc:function(t,...e){let i=g.get(t);if(!i)return"";let s=t.toLowerCase(),r=tt(s);if(void 0===r||r<1)return"";let n=r-1;return te(s,n,()=>i[n](...e))},add:function(t,e){return tb(t)+tb(e)},sub:function(t,e){return tb(t)-tb(e)},mul:function(t,e){return tb(t)*tb(e)},div:function(t,e){return tb(t)/tb(e)},neg:function(t){return-tb(t)},lt:function(t,e){return tb(t)tb(e)},ge:function(t,e){return tb(t)>=tb(e)},eq:function(t,e){return tb(t)===tb(e)},ne:function(t,e){return tb(t)!==tb(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return k(t)&k(e)},bitor:function(t,e){return k(t)|k(e)},bitxor:function(t,e){return k(t)^k(e)},shl:function(t,e){return k(k(t)<<(31&k(e)))},shr:function(t,e){return k(t)>>>(31&k(e))},bitnot:function(t){return~k(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&z(t)===i)return void s();e.default&&e.default()},deref:tw,nameToId:function(t){let e=tv(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?N.has(t):"string"==typeof t&&F.has(t)))},isFunction:function(t){return g.has(t)||t.toLowerCase()in tp},isPackage:function(t){return y.has(t)},isActivePackage:function(t){let e=y.get(t);return e?.active??!1},getPackageList:function(){return x.join(" ")},locals:tS,onMethodCalled(t,e,i){let s=D.get(t);s||(s=new o,D.set(t,s));let r=s.get(e);r||(r=[],s.set(e,r)),r.push(i)}},t_={call(t,...e){let i=g.get(t);if(i&&i.length>0)return te(t.toLowerCase(),i.length-1,()=>i[i.length-1](...e));let s=tp[t.toLowerCase()];return s?s(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tC=tM(V,{onSet:function(t,e,i){let s=z(t.startsWith("$")?t.slice(1):t);Object.is(e,i)||m(s)&&ta({type:"global.changed",name:s,value:e,previousValue:i})}}),tT={methods:f,functions:g,packages:y,activePackages:x,objectsById:N,objectsByName:F,datablocks:$,globals:V,executedScripts:H,failedScripts:J,scripts:Y,generatedCode:Q,pendingTimeouts:tl,startTime:Date.now()};function tI(t){let e=function(t){let e=Q.get(t);null==e&&(e=new n(void 0).generate(t),Q.set(t,e));return e}(t),i=tS();Function("$","$f","$g","$l",e)(tA,t_,tC,i)}function tz(t,e){return{execute(){if(e){let t=l(e);tT.executedScripts.add(t)}tI(t)}}}async function tk(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(tT.scripts.has(n)||tT.failedScripts.has(n))return;if(X&&X(n)){console.warn(`Ignoring script: ${e}`),tT.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),tT.failedScripts.add(n),t.progress?.completeItem();return}try{a=E(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),tT.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tk(a.execScriptPaths,i,h),tT.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tB(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(tT.scripts.has(s))return tz(tT.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await tR(r,{path:e});return t.progress?.completeItem(),n}async function tR(t,e){if(e?.path){let t=l(e.path);if(tT.scripts.has(t))return tz(tT.scripts.get(t),e.path)}return tO(E(t,{filename:e?.path}),e)}async function tO(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);tT.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tk(n,s,r),tz(e,i?.path)}return tc={$:tA,$f:t_,$g:tC,state:tT,destroy:function(){for(let t of(W.length>0&&tn(),tT.pendingTimeouts))clearTimeout(t);tT.pendingTimeouts.clear(),U.clear()},executeAST:tI,loadFromPath:tB,loadFromSource:tR,loadFromAST:tO,call:(t,...e)=>t_.call(t,...e),getObjectByName:t=>F.get(t),subscribeRuntimeEvents:t=>(U.add(t),()=>{U.delete(t)})}}function O(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function E(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function P(t){if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if("string"==typeof t){let e=t.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e}return!!t}function L(){let t=Error("Operation aborted");return t.name="AbortError",t}function N(t){let{missionName:e,missionType:i,runtimeOptions:s,onMissionLoadDone:r}=t,{signal:n,fileSystem:a,globals:o={},preloadScripts:h=[],reactiveGlobalNames:l}=s??{},u=a?.findFiles("scripts/*Game.cs")??[],c=l?Array.from(new Set([...l,"missionRunning"])):void 0,p=R({...s,reactiveGlobalNames:c,globals:{...o,"$Host::Map":e,"$Host::MissionType":i},preloadScripts:[...h,...u]}),d=async function(){try{let t=await p.loadFromPath("scripts/server.cs");n?.throwIfAborted(),await p.loadFromPath(`missions/${e}.mis`),n?.throwIfAborted(),t.execute();let i=function(t,e){let{signal:i,onMissionLoadDone:s}=e;return new Promise((e,r)=>{let n=!1,a=!1,o=()=>P(t.$g.get("missionRunning")),h=()=>{n||(n=!0,d(),e())},l=t=>{n||(n=!0,d(),r(t))},u=e=>{if(!s||a)return;let i=e??t.getObjectByName("Game");i&&(a=!0,s(i))},c=()=>l(L()),p=t.subscribeRuntimeEvents(t=>{if("global.changed"===t.type&&"missionrunning"===t.name){P(t.value)&&(u(),h());return}"batch.flushed"===t.type&&o()&&(u(),h())});function d(){p(),i?.removeEventListener("abort",c)}if(i){if(i.aborted)return void l(L());i.addEventListener("abort",c,{once:!0})}o()&&(u(),h())})}(p,{signal:n,onMissionLoadDone:r}),s=await p.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");n?.throwIfAborted(),s.execute(),await i}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:p,ready:d}}t.s(["createProgressTracker",()=>O],38433);let F=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,$=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,V=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,D={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function j(t){let e=E(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match($))?{type:"sectionBegin",name:e[1]}:(e=t.match(V))?{type:"sectionEnd",name:e[1]}:(e=t.match(F))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>D[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function U(t,e){if(t)return t[e.toLowerCase()]}function W(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function G(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function q(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function H(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function J(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>W,"getInt",()=>G,"getPosition",()=>q,"getProperty",()=>U,"getRotation",()=>J,"getScale",()=>H,"parseMissionScript",()=>j],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("�","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/781bfa3c9aab0c18.js b/docs/_next/static/chunks/781bfa3c9aab0c18.js new file mode 100644 index 00000000..dfd6f519 --- /dev/null +++ b/docs/_next/static/chunks/781bfa3c9aab0c18.js @@ -0,0 +1,211 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,47071,971,e=>{"use strict";var t=e.i(71645),a=e.i(90072),r=e.i(73949),n=e.i(91037);e.s(["useLoader",()=>n.G],971);var n=n;let i=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function o(e,o){let l=(0,r.useThree)(e=>e.gl),s=(0,n.G)(a.TextureLoader,i(e)?Object.values(e):e);return(0,t.useLayoutEffect)(()=>{null==o||o(s)},[o]),(0,t.useEffect)(()=>{if("initTexture"in l){let e=[];Array.isArray(s)?e=s:s instanceof a.Texture?e=[s]:i(s)&&(e=Object.values(s)),e.forEach(e=>{e instanceof a.Texture&&l.initTexture(e)})}},[l,s]),(0,t.useMemo)(()=>{if(!i(e))return s;{let t={},a=0;for(let r in e)t[r]=s[a++];return t}},[e,s])}o.preload=e=>n.G.preload(a.TextureLoader,e),o.clear=e=>n.G.clear(a.TextureLoader,e),e.s(["useTexture",()=>o],47071)},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},75567,e=>{"use strict";var t=e.i(90072);function a(e,r={}){let{repeat:n=[1,1],disableMipmaps:i=!1}=r;return e.wrapS=e.wrapT=t.RepeatWrapping,e.colorSpace=t.SRGBColorSpace,e.repeat.set(...n),e.flipY=!1,e.anisotropy=16,i?(e.generateMipmaps=!1,e.minFilter=t.LinearFilter):(e.generateMipmaps=!0,e.minFilter=t.LinearMipmapLinearFilter),e.magFilter=t.LinearFilter,e.needsUpdate=!0,e}function r(e){let a=new t.DataTexture(e,256,256,t.RedFormat,t.UnsignedByteType);return a.colorSpace=t.NoColorSpace,a.wrapS=a.wrapT=t.RepeatWrapping,a.generateMipmaps=!1,a.minFilter=t.LinearFilter,a.magFilter=t.LinearFilter,a.needsUpdate=!0,a}e.s(["setupMask",()=>r,"setupTexture",()=>a])},47021,e=>{"use strict";var t=e.i(8560);let a=` +#ifdef USE_FOG + // Check fog enabled uniform - allows toggling without shader recompilation + #ifdef USE_VOLUMETRIC_FOG + if (!fogEnabled) { + // Skip all fog calculations when disabled + } else { + #endif + + float dist = vFogDepth; + + // Discard fragments at or beyond visible distance - matches Torque's behavior + // where objects beyond visibleDistance are not rendered at all. + // This prevents fully-fogged geometry from showing as silhouettes against + // the sky's fog-to-sky gradient. + if (dist >= fogFar) { + discard; + } + + // Step 1: Calculate distance-based haze (quadratic falloff) + // Since we discard at fogFar, haze never reaches 1.0 here + float haze = 0.0; + if (dist > fogNear) { + float fogScale = 1.0 / (fogFar - fogNear); + float distFactor = (dist - fogNear) * fogScale - 1.0; + haze = 1.0 - distFactor * distFactor; + } + + // Step 2: Calculate fog volume contributions + // Note: Per-volume colors are NOT used in Tribes 2 ($specialFog defaults to false) + // All fog uses the global fogColor - see Tribes2_Fog_System.md for details + float volumeFog = 0.0; + + #ifdef USE_VOLUMETRIC_FOG + { + #ifdef USE_FOG_WORLD_POSITION + float fragmentHeight = vFogWorldPosition.y; + #else + float fragmentHeight = cameraHeight; + #endif + + float deltaY = fragmentHeight - cameraHeight; + float absDeltaY = abs(deltaY); + + // Determine if we're going up (positive) or down (negative) + if (absDeltaY > 0.01) { + // Non-horizontal ray: ray-march through fog volumes + 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]; + + // Skip inactive volumes (visibleDistance = 0) + if (volVisDist <= 0.0) continue; + + // Calculate fog factor for this volume + // From Torque: factor = (1 / (volumeVisDist * visFactor)) * percentage + // where visFactor is smVisibleDistanceMod (a user quality pref, default 1.0) + // Since we don't have quality settings, we use visFactor = 1.0 + float factor = (1.0 / volVisDist) * volPct; + + // Find ray intersection with this volume's height range + float rayMinY = min(cameraHeight, fragmentHeight); + float rayMaxY = max(cameraHeight, fragmentHeight); + + // Check if ray intersects volume height range + if (rayMinY < volMaxH && rayMaxY > volMinH) { + float intersectMin = max(rayMinY, volMinH); + float intersectMax = min(rayMaxY, volMaxH); + float intersectHeight = intersectMax - intersectMin; + + // Calculate distance traveled through this volume using similar triangles: + // subDist / dist = intersectHeight / absDeltaY + float subDist = dist * (intersectHeight / absDeltaY); + + // Accumulate fog: fog += subDist * factor + volumeFog += subDist * factor; + } + } + } else { + // Near-horizontal ray: if camera is inside a volume, apply full fog for that volume + 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 camera is inside this volume, apply fog for full distance + if (cameraHeight >= volMinH && cameraHeight <= volMaxH) { + float factor = (1.0 / volVisDist) * volPct; + volumeFog += dist * factor; + } + } + } + } + #endif + + // Step 3: Combine haze and volume fog + // Torque's clamping: if (bandPct + hazePct > 1) hazePct = 1 - bandPct + // This gives fog volumes priority over haze + float volPct = min(volumeFog, 1.0); + float hazePct = haze; + if (volPct + hazePct > 1.0) { + hazePct = 1.0 - volPct; + } + float fogFactor = hazePct + volPct; + + // Apply fog using global fogColor (per-volume colors not used in Tribes 2) + gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor); + + #ifdef USE_VOLUMETRIC_FOG + } // end fogEnabled check + #endif +#endif +`;function r(){t.ShaderChunk.fog_pars_fragment=` +#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif + + // Custom volumetric fog uniforms (only defined when USE_VOLUMETRIC_FOG is set) + // Format: [visDist, minH, maxH, percentage] x 3 volumes = 12 floats + #ifdef USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + #endif + + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_fragment=a,t.ShaderChunk.fog_pars_vertex=` +#ifdef USE_FOG + varying float vFogDepth; + #ifdef USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; + #endif +#endif +`,t.ShaderChunk.fog_vertex=` +#ifdef USE_FOG + // Use Euclidean distance from camera, not view-space z-depth + // This ensures fog doesn't change when rotating the camera + vFogDepth = length(mvPosition.xyz); + #ifdef USE_FOG_WORLD_POSITION + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; + #endif +#endif +`}function n(e,t){e.uniforms.fogVolumeData=t.fogVolumeData,e.uniforms.cameraHeight=t.cameraHeight,e.uniforms.fogEnabled=t.fogEnabled,e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_FOG_WORLD_POSITION + #define USE_VOLUMETRIC_FOG + varying vec3 vFogWorldPosition; +#endif`),e.vertexShader=e.vertexShader.replace("#include ",`#include +#ifdef USE_FOG + vFogWorldPosition = (modelMatrix * vec4(transformed, 1.0)).xyz; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",`#include +#ifdef USE_FOG + #define USE_VOLUMETRIC_FOG + uniform float fogVolumeData[12]; + uniform float cameraHeight; + uniform bool fogEnabled; + #define USE_FOG_WORLD_POSITION + varying vec3 vFogWorldPosition; +#endif`),e.fragmentShader=e.fragmentShader.replace("#include ",a)}e.s(["fogFragmentShader",0,a,"injectCustomFog",()=>n,"installCustomFogShader",()=>r])},48066,e=>{"use strict";let t={fogVolumeData:{value:new Float32Array(12)},cameraHeight:{value:0},fogEnabled:{value:!0}};function a(e,r,n=!0){t.cameraHeight.value=e,t.fogVolumeData.value.set(r),t.fogEnabled.value=n}function r(){t.cameraHeight.value=0,t.fogVolumeData.value.fill(0),t.fogEnabled.value=!0}function n(e){let t=new Float32Array(12);for(let a=0;a<3;a++){let r=4*a,n=e[a];n&&(t[r+0]=n.visibleDistance,t[r+1]=n.minHeight,t[r+2]=n.maxHeight,t[r+3]=n.percentage)}return t}e.s(["globalFogUniforms",0,t,"packFogVolumeData",()=>n,"resetGlobalFogUniforms",()=>r,"updateGlobalFogUniforms",()=>a])},89887,60099,e=>{"use strict";let t,a;var r=e.i(43476),n=e.i(932),i=e.i(71645),o=e.i(49774),l=e.i(73949),s=e.i(90072),c=e.i(31067),u=e.i(88014);let d=new s.Vector3,f=new s.Vector3,m=new s.Vector3,g=new s.Vector2;function p(e,t,a){let r=d.setFromMatrixPosition(e.matrixWorld);r.project(t);let n=a.width/2,i=a.height/2;return[r.x*n+n,-(r.y*i)+i]}let h=e=>1e-10>Math.abs(e)?0:e;function y(e,t,a=""){let r="matrix3d(";for(let a=0;16!==a;a++)r+=h(t[a]*e.elements[a])+(15!==a?",":")");return a+r}let b=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>y(e,t)),v=(a=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>y(e,a(t),"translate(-50%,-50%)")),x=i.forwardRef(({children:e,eps:t=.001,style:a,className:r,prepend:n,center:y,fullscreen:x,portal:S,distanceFactor:k,sprite:_=!1,transform:j=!1,occlude:M,onOcclude:E,castShadow:P,receiveShadow:F,material:C,geometry:I,zIndexRange:O=[0x1000037,0],calculatePosition:D=p,as:T="div",wrapperClass:w,pointerEvents:N="auto",...R},B)=>{let{gl:V,camera:L,scene:H,size:W,raycaster:U,events:z,viewport:A}=(0,l.useThree)(),[G]=i.useState(()=>document.createElement(T)),$=i.useRef(null),Y=i.useRef(null),q=i.useRef(0),K=i.useRef([0,0]),J=i.useRef(null),X=i.useRef(null),Z=(null==S?void 0:S.current)||z.connected||V.domElement.parentNode,Q=i.useRef(null),ee=i.useRef(!1),et=i.useMemo(()=>{var e;return M&&"blending"!==M||Array.isArray(M)&&M.length&&(e=M[0])&&"object"==typeof e&&"current"in e},[M]);i.useLayoutEffect(()=>{let e=V.domElement;M&&"blending"===M?(e.style.zIndex=`${Math.floor(O[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[M]),i.useLayoutEffect(()=>{if(Y.current){let e=$.current=u.createRoot(G);if(H.updateMatrixWorld(),j)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=D(Y.current,L,W);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Z&&(n?Z.prepend(G):Z.appendChild(G)),()=>{Z&&Z.removeChild(G),e.unmount()}}},[Z,j]),i.useLayoutEffect(()=>{w&&(G.className=w)},[w]);let ea=i.useMemo(()=>j?{position:"absolute",top:0,left:0,width:W.width,height:W.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:y?"translate3d(-50%,-50%,0)":"none",...x&&{top:-W.height/2,left:-W.width/2,width:W.width,height:W.height},...a},[a,y,x,W,j]),er=i.useMemo(()=>({position:"absolute",pointerEvents:N}),[N]);i.useLayoutEffect(()=>{var t,n;ee.current=!1,j?null==(t=$.current)||t.render(i.createElement("div",{ref:J,style:ea},i.createElement("div",{ref:X,style:er},i.createElement("div",{ref:B,className:r,style:a,children:e})))):null==(n=$.current)||n.render(i.createElement("div",{ref:B,style:ea,className:r,children:e}))});let en=i.useRef(!0);(0,o.useFrame)(e=>{if(Y.current){L.updateMatrixWorld(),Y.current.updateWorldMatrix(!0,!1);let e=j?K.current:D(Y.current,L,W);if(j||Math.abs(q.current-L.zoom)>t||Math.abs(K.current[0]-e[0])>t||Math.abs(K.current[1]-e[1])>t){var a;let t,r,n,i,o=(a=Y.current,t=d.setFromMatrixPosition(a.matrixWorld),r=f.setFromMatrixPosition(L.matrixWorld),n=t.sub(r),i=L.getWorldDirection(m),n.angleTo(i)>Math.PI/2),l=!1;et&&(Array.isArray(M)?l=M.map(e=>e.current):"blending"!==M&&(l=[H]));let c=en.current;l?en.current=function(e,t,a,r){let n=d.setFromMatrixPosition(e.matrixWorld),i=n.clone();i.project(t),g.set(i.x,i.y),a.setFromCamera(g,t);let o=a.intersectObjects(r,!0);if(o.length){let e=o[0].distance;return n.distanceTo(a.ray.origin)({vertexShader:j?void 0:` + /* + This shader is from the THREE's SpriteMaterial. + We need to turn the backing plane into a Sprite + (make it always face the camera) if "transfrom" + is false. + */ + #include + + void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + // This is somewhat arbitrary, but it seems to work well + // Need to figure out how to derive this dynamically if it even matters + float size = 0.03; + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + + gl_Position = projectionMatrix * mvPosition; + } + `,fragmentShader:` + void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } + `}),[j]);return i.createElement("group",(0,c.default)({},R,{ref:Y}),M&&!et&&i.createElement("mesh",{castShadow:P,receiveShadow:F,ref:Q},I||i.createElement("planeGeometry",null),C||i.createElement("shaderMaterial",{side:s.DoubleSide,vertexShader:ei.vertexShader,fragmentShader:ei.fragmentShader})))});e.s(["Html",()=>x],60099);let S=[0,0,0],k=(0,i.memo)(function(e){let t,a,c,u,d,f=(0,n.c)(19),{children:m,color:g,position:p,opacity:h}=e,y=void 0===g?"white":g,b=void 0===p?S:p,v=void 0===h?"fadeWithDistance":h,k="fadeWithDistance"===v,_=(0,i.useRef)(null),j=function(e){let t,a,r=(0,n.c)(3),{camera:c}=(0,l.useThree)(),u=(0,i.useRef)(null),d=(a=(0,i.useRef)(null),(0,o.useFrame)(()=>{e.current&&(a.current??=new s.Vector3,e.current.getWorldPosition(a.current))}),a);return r[0]!==c||r[1]!==d?(t=()=>{d.current?u.current=c.position.distanceTo(d.current):u.current=null},r[0]=c,r[1]=d,r[2]=t):t=r[2],(0,o.useFrame)(t),u}(_),[M,E]=(0,i.useState)(0!==v),P=(0,i.useRef)(null);return f[0]!==j||f[1]!==k?(t=()=>{if(k&&P.current&&null!=j.current){let e=Math.max(0,Math.min(1,1-j.current/200));P.current.style.opacity=e.toString()}},f[0]=j,f[1]=k,f[2]=t):t=f[2],f[3]!==j||f[4]!==k||f[5]!==M?(a=[M,k,j],f[3]=j,f[4]=k,f[5]=M,f[6]=a):a=f[6],(0,i.useEffect)(t,a),f[7]!==j||f[8]!==k||f[9]!==M||f[10]!==v?(c=()=>{if(k){let e=j.current,t=null!=e&&e<200;if(M!==t&&E(t),P.current&&t){let t=Math.max(0,Math.min(1,1-e/200));P.current.style.opacity=t.toString()}}else E(0!==v),P.current&&(P.current.style.opacity=v.toString())},f[7]=j,f[8]=k,f[9]=M,f[10]=v,f[11]=c):c=f[11],(0,o.useFrame)(c),f[12]!==m||f[13]!==y||f[14]!==M||f[15]!==b?(u=M?(0,r.jsx)(x,{position:b,center:!0,children:(0,r.jsx)("div",{ref:P,className:"StaticShapeLabel",style:{color:y},children:m})}):null,f[12]=m,f[13]=y,f[14]=M,f[15]=b,f[16]=u):u=f[16],f[17]!==u?(d=(0,r.jsx)("group",{ref:_,children:u}),f[17]=u,f[18]=d):d=f[18],d});e.s(["FloatingLabel",0,k],89887)},51434,e=>{"use strict";var t=e.i(43476),a=e.i(932),r=e.i(71645),n=e.i(73949),i=e.i(90072);let o=(0,r.createContext)(void 0);function l(e){let l,c,u,d,f=(0,a.c)(7),{children:m}=e,{camera:g}=(0,n.useThree)();f[0]===Symbol.for("react.memo_cache_sentinel")?(l={audioLoader:null,audioListener:null},f[0]=l):l=f[0];let[p,h]=(0,r.useState)(l);return f[1]!==g?(c=()=>{let e=new i.AudioLoader,t=g.children.find(s);t||(t=new i.AudioListener,g.add(t)),h({audioLoader:e,audioListener:t})},u=[g],f[1]=g,f[2]=c,f[3]=u):(c=f[2],u=f[3]),(0,r.useEffect)(c,u),f[4]!==p||f[5]!==m?(d=(0,t.jsx)(o.Provider,{value:p,children:m}),f[4]=p,f[5]=m,f[6]=d):d=f[6],d}function s(e){return e instanceof i.AudioListener}function c(){let e=(0,r.useContext)(o);if(void 0===e)throw Error("useAudio must be used within AudioProvider");return e}e.s(["AudioProvider",()=>l,"useAudio",()=>c])},6112,79473,58647,30064,13876,e=>{"use strict";var t=e.i(932),a=e.i(8155);let r=e=>(t,a,r)=>{let n=r.subscribe;return r.subscribe=(e,t,a)=>{let i=e;if(t){let n=(null==a?void 0:a.equalityFn)||Object.is,o=e(r.getState());i=a=>{let r=e(a);if(!n(o,r)){let e=o;t(o=r,e)}},(null==a?void 0:a.fireImmediately)&&t(o,o)}return n(i)},e(t,a,r)};e.s(["subscribeWithSelector",()=>r],79473);var n=e.i(66748);function i(e){return e.toLowerCase()}function o(e){let t=i(e.trim());return t.startsWith("$")?t.slice(1):t}let l={runtime:{runtime:null,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0},world:{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}},playback:{recording:null,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:0,streamSnapshot:null},diagnostics:{eventCounts:{"object.created":0,"object.deleted":0,"field.changed":0,"method.called":0,"global.changed":0,"batch.flushed":0},recentEvents:[],maxRecentEvents:200,webglContextLost:!1,playbackEvents:[],maxPlaybackEvents:400,rendererSamples:[],maxRendererSamples:2400}},s=(0,a.createStore)()(r(e=>({...l,setRuntime(t){let a=function(e){let t={},a={},r={},n={};for(let a of e.state.objectsById.values())t[a._id]=0,a._name&&(r[i(a._name)]=a._id,a._isDatablock&&(n[i(a._name)]=a._id));for(let t of e.state.globals.keys())a[o(t)]=0;return{objectVersionById:t,globalVersionByName:a,objectIdsByName:r,datablockIdsByName:n}}(t);e(e=>({...e,runtime:{runtime:t,objectVersionById:a.objectVersionById,globalVersionByName:a.globalVersionByName,objectIdsByName:a.objectIdsByName,datablockIdsByName:a.datablockIdsByName,lastRuntimeTick:0}}))},clearRuntime(){e(e=>({...e,runtime:{runtime:null,objectVersionById:{},globalVersionByName:{},objectIdsByName:{},datablockIdsByName:{},lastRuntimeTick:0}}))},applyRuntimeBatch(t,a){0!==t.length&&e(e=>{let r={...e.runtime.objectVersionById},n={...e.runtime.globalVersionByName},l={...e.runtime.objectIdsByName},s={...e.runtime.datablockIdsByName},c={...e.diagnostics.eventCounts},u=[...e.diagnostics.recentEvents],d=e=>{null!=e&&(r[e]=(r[e]??0)+1)};for(let e of t){if(c[e.type]=(c[e.type]??0)+1,u.push(e),"object.created"===e.type){let t=e.object;if(d(e.objectId),t._name){let a=i(t._name);l[a]=e.objectId,t._isDatablock&&(s[a]=e.objectId)}d(t._parent?._id);continue}if("object.deleted"===e.type){let t=e.object;if(delete r[e.objectId],t?._name){let e=i(t._name);delete l[e],t._isDatablock&&delete s[e]}d(t?._parent?._id);continue}if("field.changed"===e.type){d(e.objectId);continue}if("global.changed"===e.type){let t=o(e.name);n[t]=(n[t]??0)+1;continue}}let f=a?.tick??(e.runtime.lastRuntimeTick>0?e.runtime.lastRuntimeTick+1:1);c["batch.flushed"]+=1,u.push({type:"batch.flushed",tick:f,events:t});let m=e.diagnostics.maxRecentEvents,g=u.length>m?u.slice(u.length-m):u;return{...e,runtime:{...e.runtime,objectVersionById:r,globalVersionByName:n,objectIdsByName:l,datablockIdsByName:s,lastRuntimeTick:f},diagnostics:{...e.diagnostics,eventCounts:c,recentEvents:g}}})},setDemoRecording(t){let a=Math.max(0,(t?.duration??0)*1e3),r=function(e=0){let t=Error().stack;if(!t)return null;let a=t.split("\n").map(e=>e.trim()).filter(Boolean).slice(1+e,9+e);return a.length>0?a.join(" <= "):null}(1);e(e=>{let n=e.playback.streamSnapshot,i=e.playback.recording,o={t:Date.now(),kind:"recording.set",message:"setDemoRecording invoked",playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:n?.entities.length??0,streamCameraMode:n?.camera?.mode??null,streamExhausted:n?.exhausted??!1,meta:{previousMissionName:i?.missionName??null,nextMissionName:t?.missionName??null,previousDurationSec:i?Number(i.duration.toFixed(3)):null,nextDurationSec:t?Number(t.duration.toFixed(3)):null,isNull:null==t,isMetadataOnly:!!t?.isMetadataOnly,isPartial:!!t?.isPartial,hasStreamingPlayback:!!t?.streamingPlayback,stack:r??"unavailable"}};return{...e,world:function(e){if(!e)return{entitiesById:{},players:[],ghosts:[],projectiles:[],flags:[],teams:{},scores:{}};let t={},a=[],r=[],n=[],i=[];for(let o of e.entities){let e=String(o.id);t[e]=o;let l=o.type.toLowerCase();if("player"===l){a.push(e),e.startsWith("player_")&&r.push(e);continue}if("projectile"===l){n.push(e);continue}(o.dataBlock?.toLowerCase()==="flag"||o.dataBlock?.toLowerCase().includes("flag"))&&i.push(e)}return{entitiesById:t,players:a,ghosts:r,projectiles:n,flags:i,teams:{},scores:{}}}(t),playback:{recording:t,status:"stopped",timeMs:0,rate:1,frameCursor:0,durationMs:a,streamSnapshot:null},diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[o],rendererSamples:[]}}})},setPlaybackTime(t){e(e=>{var a,r,n;let i=(a=t,r=0,n=e.playback.durationMs,a<0?0:a>n?n:a);return{...e,playback:{...e.playback,timeMs:i,frameCursor:i}}})},setPlaybackStatus(t){e(e=>({...e,playback:{...e.playback,status:t}}))},setPlaybackRate(t){var a,r,n;let i=Number.isFinite(t)?(r=.01,n=16,(a=t)<.01?.01:a>16?16:a):1;e(e=>({...e,playback:{...e.playback,rate:i}}))},setPlaybackFrameCursor(t){let a=Number.isFinite(t)?t:0;e(e=>({...e,playback:{...e.playback,frameCursor:a}}))},setPlaybackStreamSnapshot(t){e(e=>({...e,playback:{...e.playback,streamSnapshot:t}}))},setWebglContextLost(t){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:t}}))},recordPlaybackDiagnosticEvent(t){e(e=>{let a=e.playback.streamSnapshot,r={t:Date.now(),kind:t.kind,message:t.message,playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:a?.entities.length??0,streamCameraMode:a?.camera?.mode??null,streamExhausted:a?.exhausted??!1,meta:t.meta},n=[...e.diagnostics.playbackEvents,r],i=e.diagnostics.maxPlaybackEvents,o=n.length>i?n.slice(n.length-i):n;return{...e,diagnostics:{...e.diagnostics,playbackEvents:o}}})},appendRendererSample(t){e(e=>{let a=e.playback.streamSnapshot,r={t:t.t??Date.now(),playbackStatus:e.playback.status,playbackTimeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,streamEntityCount:a?.entities.length??0,streamCameraMode:a?.camera?.mode??null,streamExhausted:a?.exhausted??!1,geometries:t.geometries,textures:t.textures,programs:t.programs,renderCalls:t.renderCalls,renderTriangles:t.renderTriangles,renderPoints:t.renderPoints,renderLines:t.renderLines,sceneObjects:t.sceneObjects,visibleSceneObjects:t.visibleSceneObjects,jsHeapUsed:t.jsHeapUsed,jsHeapTotal:t.jsHeapTotal,jsHeapLimit:t.jsHeapLimit},n=[...e.diagnostics.rendererSamples,r],i=e.diagnostics.maxRendererSamples,o=n.length>i?n.slice(n.length-i):n;return{...e,diagnostics:{...e.diagnostics,rendererSamples:o}}})},clearPlaybackDiagnostics(){e(e=>({...e,diagnostics:{...e.diagnostics,webglContextLost:!1,playbackEvents:[],rendererSamples:[]}}))}})));function c(){return s}function u(e,t){return(0,n.useStoreWithEqualityFn)(s,e,t)}function d(e){let a,r,n,i=(0,t.c)(7),o=u(f);i[0]!==e?(a=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,i[0]=e,i[1]=a):a=i[1];let l=u(a);if(null==e||!o||-1===l)return;i[2]!==e||i[3]!==o.state.objectsById?(r=o.state.objectsById.get(e),i[2]=e,i[3]=o.state.objectsById,i[4]=r):r=i[4];let s=r;return i[5]!==s?(n=s?{...s}:void 0,i[5]=s,i[6]=n):n=i[6],n}function f(e){return e.runtime.runtime}function m(e){let a,r,n,o,l,s=(0,t.c)(11),c=u(g);s[0]!==e?(a=e?i(e):"",s[0]=e,s[1]=a):a=s[1];let d=a;s[2]!==d?(r=e=>d?e.runtime.objectIdsByName[d]:void 0,s[2]=d,s[3]=r):r=s[3];let f=u(r);s[4]!==f?(n=e=>null==f?-1:e.runtime.objectVersionById[f]??-1,s[4]=f,s[5]=n):n=s[5];let m=u(n);if(!c||!d||null==f||-1===m)return;s[6]!==f||s[7]!==c.state.objectsById?(o=c.state.objectsById.get(f),s[6]=f,s[7]=c.state.objectsById,s[8]=o):o=s[8];let p=o;return s[9]!==p?(l=p?{...p}:void 0,s[9]=p,s[10]=l):l=s[10],l}function g(e){return e.runtime.runtime}function p(e){let a,r,n,o,l,s=(0,t.c)(11),c=u(h);s[0]!==e?(a=e?i(e):"",s[0]=e,s[1]=a):a=s[1];let d=a;s[2]!==d?(r=e=>d?e.runtime.datablockIdsByName[d]:void 0,s[2]=d,s[3]=r):r=s[3];let f=u(r);s[4]!==f?(n=e=>null==f?-1:e.runtime.objectVersionById[f]??-1,s[4]=f,s[5]=n):n=s[5];let m=u(n);if(!c||!d||null==f||-1===m)return;s[6]!==f||s[7]!==c.state.objectsById?(o=c.state.objectsById.get(f),s[6]=f,s[7]=c.state.objectsById,s[8]=o):o=s[8];let g=o;return s[9]!==g?(l=g?{...g}:void 0,s[9]=g,s[10]=l):l=s[10],l}function h(e){return e.runtime.runtime}function y(e,a){let r,n,i,o,l=(0,t.c)(13);l[0]!==a?(r=void 0===a?[]:a,l[0]=a,l[1]=r):r=l[1];let s=r,c=u(S);l[2]!==e?(n=t=>null==e?-1:t.runtime.objectVersionById[e]??-1,l[2]=e,l[3]=n):n=l[3];let d=u(n);if(null==e){let e;return l[4]!==s?(e=s.map(x),l[4]=s,l[5]=e):e=l[5],e}if(!c||-1===d){let e;return l[6]!==s?(e=s.map(v),l[6]=s,l[7]=e):e=l[7],e}let f=c.state.objectsById;if(l[8]!==e||l[9]!==c.state.objectsById){o=Symbol.for("react.early_return_sentinel");e:{let t=f.get(e);if(!t?._children){let e;l[12]===Symbol.for("react.memo_cache_sentinel")?(e=[],l[12]=e):e=l[12],o=e;break e}i=t._children.map(b)}l[8]=e,l[9]=c.state.objectsById,l[10]=i,l[11]=o}else i=l[10],o=l[11];return o!==Symbol.for("react.early_return_sentinel")?o:i}function b(e){return e._id}function v(e){return e._id}function x(e){return e._id}function S(e){return e.runtime.runtime}e.s(["engineStore",0,s,"useDatablockByName",()=>p,"useEngineSelector",()=>u,"useEngineStoreApi",()=>c,"useRuntimeChildIds",()=>y,"useRuntimeObjectById",()=>d,"useRuntimeObjectByName",()=>m],58647);let k={maxRuntimeEvents:80,maxPlaybackEvents:200,maxRendererSamples:1200,maxStreamEntities:40};function _(e){return e&&"object"==typeof e?{kind:"TorqueObject",id:"number"==typeof e._id?e._id:null,className:"string"==typeof e._className?e._className:null,class:"string"==typeof e._class?e._class:null,name:"string"==typeof e._name?e._name:null,isDatablock:!!e._isDatablock,parentId:e._parent&&"number"==typeof e._parent._id?e._parent._id:null,childCount:Array.isArray(e._children)?e._children.length:0}:null}function j(e,t={}){let a,r,n,i={...k,...t},o=(a=new WeakSet,function e(t,r=0){if(null==t)return t;let n=typeof t;if("string"===n||"number"===n||"boolean"===n)return t;if("bigint"===n)return t.toString();if("function"===n)return`[Function ${t.name||"anonymous"}]`;if("object"!==n)return String(t);if("_id"in t&&"_className"in t)return _(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){if(r>=2)return{kind:"Array",length:t.length};let a=t.slice(0,8).map(t=>e(t,r+1));return{kind:"Array",length:t.length,sample:a}}if(a.has(t))return"[Circular]";if(a.add(t),r>=2)return{kind:t?.constructor?.name??"Object"};let i=Object.keys(t).slice(0,12),o={};for(let a of i)try{o[a]=e(t[a],r+1)}catch(e){o[a]=`[Unserializable: ${e.message}]`}return Object.keys(t).length>i.length&&(o.__truncatedKeys=Object.keys(t).length-i.length),o}),l=e.diagnostics.recentEvents.slice(-i.maxRuntimeEvents).map(e=>(function(e,t){if("object.created"===e.type||"object.deleted"===e.type)return{type:e.type,objectId:e.objectId,object:_(e.object)};if("field.changed"===e.type)return{type:e.type,objectId:e.objectId,field:e.field,value:t(e.value),previousValue:t(e.previousValue),object:_(e.object)};if("method.called"===e.type)return{type:e.type,className:e.className,methodName:e.methodName,objectId:e.objectId??null,args:t(e.args)};if("global.changed"===e.type)return{type:e.type,name:e.name,value:t(e.value),previousValue:t(e.previousValue)};if("batch.flushed"===e.type){let t={};for(let a of e.events)t[a.type]=(t[a.type]??0)+1;return{type:e.type,tick:e.tick,eventCount:e.events.length,byType:t}}return{type:"unknown"}})(e,o)),s=e.diagnostics.playbackEvents.slice(-i.maxPlaybackEvents).map(e=>({...e,meta:e.meta?o(e.meta):void 0})),c=e.diagnostics.rendererSamples.slice(-i.maxRendererSamples);return{generatedAt:new Date().toISOString(),playback:{status:e.playback.status,timeMs:e.playback.timeMs,frameCursor:e.playback.frameCursor,rate:e.playback.rate,durationMs:e.playback.durationMs,recording:(r=e.playback.recording)?{duration:r.duration,missionName:r.missionName,gameType:r.gameType,isMetadataOnly:!!r.isMetadataOnly,isPartial:!!r.isPartial,hasStreamingPlayback:!!r.streamingPlayback,entitiesCount:r.entities.length,cameraModesCount:r.cameraModes.length,controlPlayerGhostId:r.controlPlayerGhostId??null}:null,streamSnapshot:function(e,t){let a=e.playback.streamSnapshot;if(!a)return null;let r={},n={};for(let e of a.entities){let t=e.type||"Unknown";r[t]=(r[t]??0)+1,e.visual?.kind&&(n[e.visual.kind]=(n[e.visual.kind]??0)+1)}let i=a.entities.slice(0,t).map(e=>({id:e.id,type:e.type,dataBlock:e.dataBlock??null,className:e.className??null,ghostIndex:e.ghostIndex??null,dataBlockId:e.dataBlockId??null,shapeHint:e.shapeHint??null,visualKind:e.visual?.kind??null,hasPosition:!!e.position,hasRotation:!!e.rotation}));return{timeSec:a.timeSec,exhausted:a.exhausted,cameraMode:a.camera?.mode??null,controlEntityId:a.camera?.controlEntityId??null,orbitTargetId:a.camera?.orbitTargetId??null,controlPlayerGhostId:a.controlPlayerGhostId??null,entityCount:a.entities.length,entitiesByType:r,visualsByKind:n,entitySample:i,status:a.status}}(e,i.maxStreamEntities)},runtime:(n=e.runtime.runtime)?{lastRuntimeTick:e.runtime.lastRuntimeTick,objectCount:n.state.objectsById.size,datablockCount:n.state.datablocks.size,globalCount:n.state.globals.size,activePackageCount:n.state.activePackages.length,executedScriptCount:n.state.executedScripts.size,failedScriptCount:n.state.failedScripts.size}:null,diagnostics:{webglContextLost:e.diagnostics.webglContextLost,eventCounts:e.diagnostics.eventCounts,playbackEventCount:e.diagnostics.playbackEvents.length,rendererSampleCount:e.diagnostics.rendererSamples.length,runtimeEventCount:e.diagnostics.recentEvents.length,playbackEventsByKind:function(e){let t={};for(let a of e)t[a.kind]=(t[a.kind]??0)+1;return t}(e.diagnostics.playbackEvents),rendererTrend:function(e){if(e.length<2)return null;let t=e[0],a=e[e.length-1];return{sampleCount:e.length,durationSec:Number(((a.t-t.t)/1e3).toFixed(3)),geometriesDelta:a.geometries-t.geometries,texturesDelta:a.textures-t.textures,programsDelta:a.programs-t.programs,sceneObjectsDelta:a.sceneObjects-t.sceneObjects,visibleSceneObjectsDelta:a.visibleSceneObjects-t.visibleSceneObjects,renderCallsDelta:a.renderCalls-t.renderCalls}}(c),playbackEvents:s,rendererSamples:c,runtimeEvents:l}}}function M(e,t={}){return JSON.stringify(j(e,t),null,2)}function E(e){return p(e)}e.s(["buildSerializableDiagnosticsJson",()=>M,"buildSerializableDiagnosticsSnapshot",()=>j],30064),e.s([],13876),e.s(["useDatablock",()=>E],6112)},61921,e=>{e.v(t=>Promise.all(["static/chunks/cb4089eec9313f48.js"].map(t=>e.l(t))).then(()=>t(29055)))},25147,e=>{e.v(t=>Promise.all(["static/chunks/b9c295cb642f6712.js"].map(t=>e.l(t))).then(()=>t(63724)))},18599,e=>{e.v(t=>Promise.all(["static/chunks/6e74e9455d83b68c.js"].map(t=>e.l(t))).then(()=>t(42585)))},84968,e=>{e.v(t=>Promise.all(["static/chunks/70bf3e06d5674fac.js"].map(t=>e.l(t))).then(()=>t(90208)))},59197,e=>{e.v(t=>Promise.all(["static/chunks/0be79f7f5e0597a7.css","static/chunks/1cf33c843f96e1c9.js"].map(t=>e.l(t))).then(()=>t(94247)))}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/afff663ba7029ccf.css b/docs/_next/static/chunks/afff663ba7029ccf.css new file mode 100644 index 00000000..337341c6 --- /dev/null +++ b/docs/_next/static/chunks/afff663ba7029ccf.css @@ -0,0 +1 @@ +.PlayerHUD-module__-E1Scq__PlayerHUD{z-index:1;pointer-events:none;padding-bottom:48px;position:absolute;inset:0}.PlayerHUD-module__-E1Scq__ChatWindow{position:absolute;top:60px;left:4px}.PlayerHUD-module__-E1Scq__Bar{background:#00000080;border:1px solid #fff3;width:160px;height:14px;position:absolute;overflow:hidden}.PlayerHUD-module__-E1Scq__HealthBar{top:60px;right:32px;}.PlayerHUD-module__-E1Scq__EnergyBar{top:80px;right:32px;}.PlayerHUD-module__-E1Scq__BarFill{height:100%;transition:width .15s ease-out;position:absolute;top:0;left:0}.PlayerHUD-module__-E1Scq__HealthBar .PlayerHUD-module__-E1Scq__BarFill{background:#2ecc40}.PlayerHUD-module__-E1Scq__EnergyBar .PlayerHUD-module__-E1Scq__BarFill{background:#0af} diff --git a/docs/_next/static/chunks/4e5626f3eeee0985.js b/docs/_next/static/chunks/b9c295cb642f6712.js similarity index 64% rename from docs/_next/static/chunks/4e5626f3eeee0985.js rename to docs/_next/static/chunks/b9c295cb642f6712.js index 65e96d0f..21454bcc 100644 --- a/docs/_next/static/chunks/4e5626f3eeee0985.js +++ b/docs/_next/static/chunks/b9c295cb642f6712.js @@ -1,4 +1,4 @@ -(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),t=e.i(932),o=e.i(71645),a=e.i(47071),l=e.i(49774),i=e.i(90072),n=e.i(62395),c=e.i(12979),s=e.i(79123),u=e.i(6112);let f=` +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),t=e.i(932),o=e.i(71645),a=e.i(47071),l=e.i(49774),i=e.i(90072),n=e.i(62395),s=e.i(12979),c=e.i(79123),u=e.i(6112);let f=` #include varying vec2 vUv; @@ -72,4 +72,4 @@ void main() { gl_FragColor.a *= 1.0 - fogFactor; #endif } -`;function d(e){let r,a,l,n=(0,t.c)(7),[c,s,u]=e;n[0]!==c||n[1]!==s||n[2]!==u?((r=new i.BoxGeometry(c,s,u)).translate(c/2,s/2,u/2),n[0]=c,n[1]=s,n[2]=u,n[3]=r):r=n[3];let f=r;return n[4]!==f?(a=()=>()=>f.dispose(),l=[f],n[4]=f,n[5]=a,n[6]=l):(a=n[5],l=n[6]),(0,o.useEffect)(a,l),f}function p({scale:e,color:t,baseTranslucency:n,textureUrls:c,numFrames:u,framesPerSec:p,scrollSpeed:v,umapping:g,vmapping:x}){let{animationEnabled:F}=(0,s.useSettings)(),y=d(e),S=(0,a.useTexture)(c,e=>{e.forEach(e=>{e.wrapS=e.wrapT=i.RepeatWrapping,e.colorSpace=i.NoColorSpace,e.flipY=!1,e.needsUpdate=!0})}),h=(0,o.useMemo)(()=>(function({textures:e,scale:r,umapping:t,vmapping:o,color:a,baseTranslucency:l}){let n=[...r].sort((e,r)=>r-e),c=new i.Vector2(n[0]*t,n[1]*o),s=e[0];return new i.ShaderMaterial({uniforms:{frame0:{value:s},frame1:{value:e[1]??s},frame2:{value:e[2]??s},frame3:{value:e[3]??s},frame4:{value:e[4]??s},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:c},tintColor:{value:new i.Color(...a)},opacity:{value:l},opacityFactor:{value:1},fogColor:{value:new i.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:f,fragmentShader:m,transparent:!0,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!0})})({textures:S,scale:e,umapping:g,vmapping:x,color:t,baseTranslucency:n}),[S,e,g,x,t,n]);(0,o.useEffect)(()=>()=>h.dispose(),[h]);let C=(0,o.useRef)(0);return(0,l.useFrame)((e,r)=>{if(!F){C.current=0,h.uniforms.currentFrame.value=0,h.uniforms.vScroll.value=0;return}C.current+=r,h.uniforms.currentFrame.value=Math.floor(C.current*p)%u,h.uniforms.vScroll.value=C.current*v}),(0,r.jsx)("mesh",{geometry:y,material:h,renderOrder:1})}function v(e){let o,a,l,n=(0,t.c)(10),{scale:c,color:s,baseTranslucency:u}=e,f=d(c);n[0]!==s[0]||n[1]!==s[1]||n[2]!==s[2]?(o=new i.Color(s[0],s[1],s[2]),n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=o):o=n[3];let m=o,p=+u;return n[4]!==m||n[5]!==p?(a=(0,r.jsx)("meshBasicMaterial",{color:m,transparent:!0,opacity:p,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!1}),n[4]=m,n[5]=p,n[6]=a):a=n[6],n[7]!==f||n[8]!==a?(l=(0,r.jsx)("mesh",{geometry:f,renderOrder:1,children:a}),n[7]=f,n[8]=a,n[9]=l):l=n[9],l}let g=(0,o.memo)(function(e){let a,l,i,s,f,m,d,g,x,F,y,S,h,C,b,U,P,D=(0,t.c)(48),{object:w}=e;D[0]!==w?(a=(0,n.getPosition)(w),D[0]=w,D[1]=a):a=D[1];let T=a;D[2]!==w?(l=(0,n.getRotation)(w),D[2]=w,D[3]=l):l=D[3];let j=l;D[4]!==w?(i=(0,n.getScale)(w),D[4]=w,D[5]=i):i=D[5];let B=i;D[6]!==w?(s=(0,n.getProperty)(w,"dataBlock"),D[6]=w,D[7]=s):s=D[7];let _=(0,u.useDatablock)(s);D[8]!==_?(f=(0,n.getProperty)(_,"color"),D[8]=_,D[9]=f):f=D[9];let O=f;if(D[10]!==O){let e;m=O?[(e=O.split(" ").map(e=>parseFloat(e)))[0]??0,e[1]??0,e[2]??0]:[1,1,1],D[10]=O,D[11]=m}else m=D[11];let M=m;D[12]!==_?(d=parseFloat((0,n.getProperty)(_,"baseTranslucency"))||1,D[12]=_,D[13]=d):d=D[13];let N=d;D[14]!==_?(g=parseInt((0,n.getProperty)(_,"numFrames"),10)||1,D[14]=_,D[15]=g):g=D[15];let R=g;D[16]!==_?(x=parseFloat((0,n.getProperty)(_,"framesPerSec"))||1,D[16]=_,D[17]=x):x=D[17];let k=x;D[18]!==_?(F=parseFloat((0,n.getProperty)(_,"scrollSpeed"))||0,D[18]=_,D[19]=F):F=D[19];let A=F;D[20]!==_?(y=parseFloat((0,n.getProperty)(_,"umapping"))||1,D[20]=_,D[21]=y):y=D[21];let E=y;D[22]!==_?(S=parseFloat((0,n.getProperty)(_,"vmapping"))||1,D[22]=_,D[23]=S):S=D[23];let G=S;D[24]!==_||D[25]!==R?(h=function(e,r){let t=[];for(let o=0;o()=>f.dispose(),l=[f],n[4]=f,n[5]=a,n[6]=l):(a=n[5],l=n[6]),(0,o.useEffect)(a,l),f}function p({scale:e,color:t,baseTranslucency:n,textureUrls:s,numFrames:u,framesPerSec:p,scrollSpeed:v,umapping:g,vmapping:x}){let{animationEnabled:F}=(0,c.useSettings)(),y=d(e),S=(0,a.useTexture)(s,e=>{e.forEach(e=>{e.wrapS=e.wrapT=i.RepeatWrapping,e.colorSpace=i.NoColorSpace,e.flipY=!1,e.needsUpdate=!0})}),h=(0,o.useMemo)(()=>(function({textures:e,scale:r,umapping:t,vmapping:o,color:a,baseTranslucency:l}){let n=[...r].sort((e,r)=>r-e),s=new i.Vector2(n[0]*t,n[1]*o),c=e[0];return new i.ShaderMaterial({uniforms:{frame0:{value:c},frame1:{value:e[1]??c},frame2:{value:e[2]??c},frame3:{value:e[3]??c},frame4:{value:e[4]??c},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:s},tintColor:{value:new i.Color(...a)},opacity:{value:l},opacityFactor:{value:1},fogColor:{value:new i.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:f,fragmentShader:m,transparent:!0,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!0})})({textures:S,scale:e,umapping:g,vmapping:x,color:t,baseTranslucency:n}),[S,e,g,x,t,n]);(0,o.useEffect)(()=>()=>h.dispose(),[h]);let C=(0,o.useRef)(0);return(0,l.useFrame)((e,r)=>{if(!F){C.current=0,h.uniforms.currentFrame.value=0,h.uniforms.vScroll.value=0;return}C.current+=r,h.uniforms.currentFrame.value=Math.floor(C.current*p)%u,h.uniforms.vScroll.value=C.current*v}),(0,r.jsx)("mesh",{geometry:y,material:h,renderOrder:1})}function v(e){let o,a,l,n=(0,t.c)(10),{scale:s,color:c,baseTranslucency:u}=e,f=d(s);n[0]!==c[0]||n[1]!==c[1]||n[2]!==c[2]?(o=new i.Color(c[0],c[1],c[2]),n[0]=c[0],n[1]=c[1],n[2]=c[2],n[3]=o):o=n[3];let m=o,p=+u;return n[4]!==m||n[5]!==p?(a=(0,r.jsx)("meshBasicMaterial",{color:m,transparent:!0,opacity:p,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!1}),n[4]=m,n[5]=p,n[6]=a):a=n[6],n[7]!==f||n[8]!==a?(l=(0,r.jsx)("mesh",{geometry:f,renderOrder:1,children:a}),n[7]=f,n[8]=a,n[9]=l):l=n[9],l}let g=(0,o.memo)(function(e){let a,l,i,c,f,m,d,g,x,F,y,S,h,C,b,U,P,D=(0,t.c)(56),{object:w}=e;D[0]!==w?(a=(0,n.getPosition)(w),D[0]=w,D[1]=a):a=D[1];let T=a;D[2]!==w?(l=(0,n.getRotation)(w),D[2]=w,D[3]=l):l=D[3];let j=l;D[4]!==w?(i=(0,n.getScale)(w),D[4]=w,D[5]=i):i=D[5];let B=i;D[6]!==w?(c=(0,n.getProperty)(w,"dataBlock"),D[6]=w,D[7]=c):c=D[7];let _=(0,u.useDatablock)(c);D[8]!==_?(f=(0,n.getProperty)(_,"color"),D[8]=_,D[9]=f):f=D[9];let O=f;if(D[10]!==O){let e;m=O?[(e=O.split(" ").map(e=>parseFloat(e)))[0]??0,e[1]??0,e[2]??0]:[1,1,1],D[10]=O,D[11]=m}else m=D[11];let M=m;D[12]!==_?(d=parseFloat((0,n.getProperty)(_,"baseTranslucency"))||1,D[12]=_,D[13]=d):d=D[13];let N=d;D[14]!==_?(g=parseInt((0,n.getProperty)(_,"numFrames"),10)||1,D[14]=_,D[15]=g):g=D[15];let R=g;D[16]!==_?(x=parseFloat((0,n.getProperty)(_,"framesPerSec"))||1,D[16]=_,D[17]=x):x=D[17];let k=x;D[18]!==_?(F=parseFloat((0,n.getProperty)(_,"scrollSpeed"))||0,D[18]=_,D[19]=F):F=D[19];let A=F;D[20]!==_?(y=parseFloat((0,n.getProperty)(_,"umapping"))||1,D[20]=_,D[21]=y):y=D[21];let E=y;D[22]!==_?(S=parseFloat((0,n.getProperty)(_,"vmapping"))||1,D[22]=_,D[23]=S):S=D[23];let q=S;D[24]!==_||D[25]!==R?(h=function(e,r){let t=[];for(let o=0;o{var n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},i=Object.keys(n).join("|"),a=RegExp(i,"g"),o=RegExp(i,"");function l(e){return n[e]}var s=function(e){return e.replace(a,l)};t.exports=s,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=s},29402,(e,t,r)=>{var n,i,a,o,l="__lodash_hash_undefined__",s=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",m="[object Error]",h="[object Function]",p="[object Map]",A="[object Number]",g="[object Object]",v="[object Promise]",B="[object RegExp]",C="[object Set]",y="[object String]",b="[object Symbol]",x="[object WeakMap]",E="[object ArrayBuffer]",M="[object DataView]",S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,T=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,D=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,G={};G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G[u]=G[c]=G[E]=G[d]=G[M]=G[f]=G[m]=G[h]=G[p]=G[A]=G[g]=G[B]=G[C]=G[y]=G[x]=!1;var L=e.g&&e.g.Object===Object&&e.g,_="object"==typeof self&&self&&self.Object===Object&&self,P=L||_||Function("return this")(),O=r&&!r.nodeType&&r,k=O&&t&&!t.nodeType&&t,H=k&&k.exports===O&&L.process,j=function(){try{return H&&H.binding("util")}catch(e){}}(),U=j&&j.isTypedArray;function N(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eS(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ex.prototype.clear=function(){this.__data__={hash:new ey,map:new(es||eb),string:new ey}},ex.prototype.delete=function(e){return eL(this,e).delete(e)},ex.prototype.get=function(e){return eL(this,e).get(e)},ex.prototype.has=function(e){return eL(this,e).has(e)},ex.prototype.set=function(e,t){return eL(this,e).set(e,t),this},eE.prototype.add=eE.prototype.push=function(e){return this.__data__.set(e,l),this},eE.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.clear=function(){this.__data__=new eb},eM.prototype.delete=function(e){return this.__data__.delete(e)},eM.prototype.get=function(e){return this.__data__.get(e)},eM.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!es||n.length<199)return n.push([e,t]),this;r=this.__data__=new ex(n)}return r.set(e,t),this};var eF=(n=function(e,t){return e&&eT(e,t,e0)},function(e,t){if(null==e)return e;if(!eX(e))return n(e,t);for(var r=e.length,i=-1,a=Object(e);++il))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eE:void 0;for(a.set(e,t),a.set(t,e);++c-1&&e%1==0&&e-1&&e%1==0&&e<=0x1fffffffffffff}function eY(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ez(e){return!!e&&"object"==typeof e}function eZ(e){return"symbol"==typeof e||ez(e)&&ee.call(e)==b}var e$=U?J(U):function(e){return ez(e)&&eW(e.length)&&!!G[ee.call(e)]};function e0(e){return eX(e)?function(e,t){var r=eV(e)||eQ(e)?function(e,t){for(var r=-1,n=Array(e);++rt||a&&o&&s&&!l&&!u||n&&o&&s||!r&&s||!i)return 1;if(!n&&!a&&!u&&e=l)return s;return s*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});s--;)l[s]=l[s].value;return l}(e,t,r))}},81405,(e,t,r)=>{var n;e.e,(n=function(){function e(e){return i.appendChild(e.dom),e}function t(e){for(var t=0;to+1e3&&(s.update(1e3*l/(e-o),100),o=e,l=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:t}}).Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),l=80*o,s=48*o,u=3*o,c=2*o,d=3*o,f=15*o,m=74*o,h=30*o,p=document.createElement("canvas");p.width=l,p.height=s,p.style.cssText="width:80px;height:48px";var A=p.getContext("2d");return A.font="bold "+9*o+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,l,s),A.fillStyle=t,A.fillText(e,u,c),A.fillRect(d,f,m,h),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d,f,m,h),{dom:p,update:function(s,g){n=Math.min(n,s),i=Math.max(i,s),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,l,f),A.fillStyle=t,A.fillText(a(s)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),A.drawImage(p,d+o,f,m-o,h,d,f,m-o,h),A.fillRect(d+m-o,f,o,h),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d+m-o,f,o,a((1-s/g)*h))}}},t.exports=n},31713,e=>{"use strict";let t;var r,n,i=e.i(43476),a=e.i(932),o=e.i(71645),l=e.i(91037),s=e.i(8560),u=e.i(90072);e.s(["ACESFilmicToneMapping",()=>u.ACESFilmicToneMapping,"AddEquation",()=>u.AddEquation,"AddOperation",()=>u.AddOperation,"AdditiveAnimationBlendMode",()=>u.AdditiveAnimationBlendMode,"AdditiveBlending",()=>u.AdditiveBlending,"AgXToneMapping",()=>u.AgXToneMapping,"AlphaFormat",()=>u.AlphaFormat,"AlwaysCompare",()=>u.AlwaysCompare,"AlwaysDepth",()=>u.AlwaysDepth,"AlwaysStencilFunc",()=>u.AlwaysStencilFunc,"AmbientLight",()=>u.AmbientLight,"AnimationAction",()=>u.AnimationAction,"AnimationClip",()=>u.AnimationClip,"AnimationLoader",()=>u.AnimationLoader,"AnimationMixer",()=>u.AnimationMixer,"AnimationObjectGroup",()=>u.AnimationObjectGroup,"AnimationUtils",()=>u.AnimationUtils,"ArcCurve",()=>u.ArcCurve,"ArrayCamera",()=>u.ArrayCamera,"ArrowHelper",()=>u.ArrowHelper,"AttachedBindMode",()=>u.AttachedBindMode,"Audio",()=>u.Audio,"AudioAnalyser",()=>u.AudioAnalyser,"AudioContext",()=>u.AudioContext,"AudioListener",()=>u.AudioListener,"AudioLoader",()=>u.AudioLoader,"AxesHelper",()=>u.AxesHelper,"BackSide",()=>u.BackSide,"BasicDepthPacking",()=>u.BasicDepthPacking,"BasicShadowMap",()=>u.BasicShadowMap,"BatchedMesh",()=>u.BatchedMesh,"Bone",()=>u.Bone,"BooleanKeyframeTrack",()=>u.BooleanKeyframeTrack,"Box2",()=>u.Box2,"Box3",()=>u.Box3,"Box3Helper",()=>u.Box3Helper,"BoxGeometry",()=>u.BoxGeometry,"BoxHelper",()=>u.BoxHelper,"BufferAttribute",()=>u.BufferAttribute,"BufferGeometry",()=>u.BufferGeometry,"BufferGeometryLoader",()=>u.BufferGeometryLoader,"ByteType",()=>u.ByteType,"Cache",()=>u.Cache,"Camera",()=>u.Camera,"CameraHelper",()=>u.CameraHelper,"CanvasTexture",()=>u.CanvasTexture,"CapsuleGeometry",()=>u.CapsuleGeometry,"CatmullRomCurve3",()=>u.CatmullRomCurve3,"CineonToneMapping",()=>u.CineonToneMapping,"CircleGeometry",()=>u.CircleGeometry,"ClampToEdgeWrapping",()=>u.ClampToEdgeWrapping,"Clock",()=>u.Clock,"Color",()=>u.Color,"ColorKeyframeTrack",()=>u.ColorKeyframeTrack,"ColorManagement",()=>u.ColorManagement,"CompressedArrayTexture",()=>u.CompressedArrayTexture,"CompressedCubeTexture",()=>u.CompressedCubeTexture,"CompressedTexture",()=>u.CompressedTexture,"CompressedTextureLoader",()=>u.CompressedTextureLoader,"ConeGeometry",()=>u.ConeGeometry,"ConstantAlphaFactor",()=>u.ConstantAlphaFactor,"ConstantColorFactor",()=>u.ConstantColorFactor,"Controls",()=>u.Controls,"CubeCamera",()=>u.CubeCamera,"CubeDepthTexture",()=>u.CubeDepthTexture,"CubeReflectionMapping",()=>u.CubeReflectionMapping,"CubeRefractionMapping",()=>u.CubeRefractionMapping,"CubeTexture",()=>u.CubeTexture,"CubeTextureLoader",()=>u.CubeTextureLoader,"CubeUVReflectionMapping",()=>u.CubeUVReflectionMapping,"CubicBezierCurve",()=>u.CubicBezierCurve,"CubicBezierCurve3",()=>u.CubicBezierCurve3,"CubicInterpolant",()=>u.CubicInterpolant,"CullFaceBack",()=>u.CullFaceBack,"CullFaceFront",()=>u.CullFaceFront,"CullFaceFrontBack",()=>u.CullFaceFrontBack,"CullFaceNone",()=>u.CullFaceNone,"Curve",()=>u.Curve,"CurvePath",()=>u.CurvePath,"CustomBlending",()=>u.CustomBlending,"CustomToneMapping",()=>u.CustomToneMapping,"CylinderGeometry",()=>u.CylinderGeometry,"Cylindrical",()=>u.Cylindrical,"Data3DTexture",()=>u.Data3DTexture,"DataArrayTexture",()=>u.DataArrayTexture,"DataTexture",()=>u.DataTexture,"DataTextureLoader",()=>u.DataTextureLoader,"DataUtils",()=>u.DataUtils,"DecrementStencilOp",()=>u.DecrementStencilOp,"DecrementWrapStencilOp",()=>u.DecrementWrapStencilOp,"DefaultLoadingManager",()=>u.DefaultLoadingManager,"DepthFormat",()=>u.DepthFormat,"DepthStencilFormat",()=>u.DepthStencilFormat,"DepthTexture",()=>u.DepthTexture,"DetachedBindMode",()=>u.DetachedBindMode,"DirectionalLight",()=>u.DirectionalLight,"DirectionalLightHelper",()=>u.DirectionalLightHelper,"DiscreteInterpolant",()=>u.DiscreteInterpolant,"DodecahedronGeometry",()=>u.DodecahedronGeometry,"DoubleSide",()=>u.DoubleSide,"DstAlphaFactor",()=>u.DstAlphaFactor,"DstColorFactor",()=>u.DstColorFactor,"DynamicCopyUsage",()=>u.DynamicCopyUsage,"DynamicDrawUsage",()=>u.DynamicDrawUsage,"DynamicReadUsage",()=>u.DynamicReadUsage,"EdgesGeometry",()=>u.EdgesGeometry,"EllipseCurve",()=>u.EllipseCurve,"EqualCompare",()=>u.EqualCompare,"EqualDepth",()=>u.EqualDepth,"EqualStencilFunc",()=>u.EqualStencilFunc,"EquirectangularReflectionMapping",()=>u.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>u.EquirectangularRefractionMapping,"Euler",()=>u.Euler,"EventDispatcher",()=>u.EventDispatcher,"ExternalTexture",()=>u.ExternalTexture,"ExtrudeGeometry",()=>u.ExtrudeGeometry,"FileLoader",()=>u.FileLoader,"Float16BufferAttribute",()=>u.Float16BufferAttribute,"Float32BufferAttribute",()=>u.Float32BufferAttribute,"FloatType",()=>u.FloatType,"Fog",()=>u.Fog,"FogExp2",()=>u.FogExp2,"FramebufferTexture",()=>u.FramebufferTexture,"FrontSide",()=>u.FrontSide,"Frustum",()=>u.Frustum,"FrustumArray",()=>u.FrustumArray,"GLBufferAttribute",()=>u.GLBufferAttribute,"GLSL1",()=>u.GLSL1,"GLSL3",()=>u.GLSL3,"GreaterCompare",()=>u.GreaterCompare,"GreaterDepth",()=>u.GreaterDepth,"GreaterEqualCompare",()=>u.GreaterEqualCompare,"GreaterEqualDepth",()=>u.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>u.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>u.GreaterStencilFunc,"GridHelper",()=>u.GridHelper,"Group",()=>u.Group,"HalfFloatType",()=>u.HalfFloatType,"HemisphereLight",()=>u.HemisphereLight,"HemisphereLightHelper",()=>u.HemisphereLightHelper,"IcosahedronGeometry",()=>u.IcosahedronGeometry,"ImageBitmapLoader",()=>u.ImageBitmapLoader,"ImageLoader",()=>u.ImageLoader,"ImageUtils",()=>u.ImageUtils,"IncrementStencilOp",()=>u.IncrementStencilOp,"IncrementWrapStencilOp",()=>u.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>u.InstancedBufferAttribute,"InstancedBufferGeometry",()=>u.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>u.InstancedInterleavedBuffer,"InstancedMesh",()=>u.InstancedMesh,"Int16BufferAttribute",()=>u.Int16BufferAttribute,"Int32BufferAttribute",()=>u.Int32BufferAttribute,"Int8BufferAttribute",()=>u.Int8BufferAttribute,"IntType",()=>u.IntType,"InterleavedBuffer",()=>u.InterleavedBuffer,"InterleavedBufferAttribute",()=>u.InterleavedBufferAttribute,"Interpolant",()=>u.Interpolant,"InterpolateDiscrete",()=>u.InterpolateDiscrete,"InterpolateLinear",()=>u.InterpolateLinear,"InterpolateSmooth",()=>u.InterpolateSmooth,"InterpolationSamplingMode",()=>u.InterpolationSamplingMode,"InterpolationSamplingType",()=>u.InterpolationSamplingType,"InvertStencilOp",()=>u.InvertStencilOp,"KeepStencilOp",()=>u.KeepStencilOp,"KeyframeTrack",()=>u.KeyframeTrack,"LOD",()=>u.LOD,"LatheGeometry",()=>u.LatheGeometry,"Layers",()=>u.Layers,"LessCompare",()=>u.LessCompare,"LessDepth",()=>u.LessDepth,"LessEqualCompare",()=>u.LessEqualCompare,"LessEqualDepth",()=>u.LessEqualDepth,"LessEqualStencilFunc",()=>u.LessEqualStencilFunc,"LessStencilFunc",()=>u.LessStencilFunc,"Light",()=>u.Light,"LightProbe",()=>u.LightProbe,"Line",()=>u.Line,"Line3",()=>u.Line3,"LineBasicMaterial",()=>u.LineBasicMaterial,"LineCurve",()=>u.LineCurve,"LineCurve3",()=>u.LineCurve3,"LineDashedMaterial",()=>u.LineDashedMaterial,"LineLoop",()=>u.LineLoop,"LineSegments",()=>u.LineSegments,"LinearFilter",()=>u.LinearFilter,"LinearInterpolant",()=>u.LinearInterpolant,"LinearMipMapLinearFilter",()=>u.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>u.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>u.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>u.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>u.LinearSRGBColorSpace,"LinearToneMapping",()=>u.LinearToneMapping,"LinearTransfer",()=>u.LinearTransfer,"Loader",()=>u.Loader,"LoaderUtils",()=>u.LoaderUtils,"LoadingManager",()=>u.LoadingManager,"LoopOnce",()=>u.LoopOnce,"LoopPingPong",()=>u.LoopPingPong,"LoopRepeat",()=>u.LoopRepeat,"MOUSE",()=>u.MOUSE,"Material",()=>u.Material,"MaterialLoader",()=>u.MaterialLoader,"MathUtils",()=>u.MathUtils,"Matrix2",()=>u.Matrix2,"Matrix3",()=>u.Matrix3,"Matrix4",()=>u.Matrix4,"MaxEquation",()=>u.MaxEquation,"Mesh",()=>u.Mesh,"MeshBasicMaterial",()=>u.MeshBasicMaterial,"MeshDepthMaterial",()=>u.MeshDepthMaterial,"MeshDistanceMaterial",()=>u.MeshDistanceMaterial,"MeshLambertMaterial",()=>u.MeshLambertMaterial,"MeshMatcapMaterial",()=>u.MeshMatcapMaterial,"MeshNormalMaterial",()=>u.MeshNormalMaterial,"MeshPhongMaterial",()=>u.MeshPhongMaterial,"MeshPhysicalMaterial",()=>u.MeshPhysicalMaterial,"MeshStandardMaterial",()=>u.MeshStandardMaterial,"MeshToonMaterial",()=>u.MeshToonMaterial,"MinEquation",()=>u.MinEquation,"MirroredRepeatWrapping",()=>u.MirroredRepeatWrapping,"MixOperation",()=>u.MixOperation,"MultiplyBlending",()=>u.MultiplyBlending,"MultiplyOperation",()=>u.MultiplyOperation,"NearestFilter",()=>u.NearestFilter,"NearestMipMapLinearFilter",()=>u.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>u.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>u.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>u.NearestMipmapNearestFilter,"NeutralToneMapping",()=>u.NeutralToneMapping,"NeverCompare",()=>u.NeverCompare,"NeverDepth",()=>u.NeverDepth,"NeverStencilFunc",()=>u.NeverStencilFunc,"NoBlending",()=>u.NoBlending,"NoColorSpace",()=>u.NoColorSpace,"NoNormalPacking",()=>u.NoNormalPacking,"NoToneMapping",()=>u.NoToneMapping,"NormalAnimationBlendMode",()=>u.NormalAnimationBlendMode,"NormalBlending",()=>u.NormalBlending,"NormalGAPacking",()=>u.NormalGAPacking,"NormalRGPacking",()=>u.NormalRGPacking,"NotEqualCompare",()=>u.NotEqualCompare,"NotEqualDepth",()=>u.NotEqualDepth,"NotEqualStencilFunc",()=>u.NotEqualStencilFunc,"NumberKeyframeTrack",()=>u.NumberKeyframeTrack,"Object3D",()=>u.Object3D,"ObjectLoader",()=>u.ObjectLoader,"ObjectSpaceNormalMap",()=>u.ObjectSpaceNormalMap,"OctahedronGeometry",()=>u.OctahedronGeometry,"OneFactor",()=>u.OneFactor,"OneMinusConstantAlphaFactor",()=>u.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>u.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>u.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>u.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>u.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>u.OneMinusSrcColorFactor,"OrthographicCamera",()=>u.OrthographicCamera,"PCFShadowMap",()=>u.PCFShadowMap,"PCFSoftShadowMap",()=>u.PCFSoftShadowMap,"PMREMGenerator",()=>s.PMREMGenerator,"Path",()=>u.Path,"PerspectiveCamera",()=>u.PerspectiveCamera,"Plane",()=>u.Plane,"PlaneGeometry",()=>u.PlaneGeometry,"PlaneHelper",()=>u.PlaneHelper,"PointLight",()=>u.PointLight,"PointLightHelper",()=>u.PointLightHelper,"Points",()=>u.Points,"PointsMaterial",()=>u.PointsMaterial,"PolarGridHelper",()=>u.PolarGridHelper,"PolyhedronGeometry",()=>u.PolyhedronGeometry,"PositionalAudio",()=>u.PositionalAudio,"PropertyBinding",()=>u.PropertyBinding,"PropertyMixer",()=>u.PropertyMixer,"QuadraticBezierCurve",()=>u.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>u.QuadraticBezierCurve3,"Quaternion",()=>u.Quaternion,"QuaternionKeyframeTrack",()=>u.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>u.QuaternionLinearInterpolant,"R11_EAC_Format",()=>u.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>u.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>u.RED_RGTC1_Format,"REVISION",()=>u.REVISION,"RG11_EAC_Format",()=>u.RG11_EAC_Format,"RGBADepthPacking",()=>u.RGBADepthPacking,"RGBAFormat",()=>u.RGBAFormat,"RGBAIntegerFormat",()=>u.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>u.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>u.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>u.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>u.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>u.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>u.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>u.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>u.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>u.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>u.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>u.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>u.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>u.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>u.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>u.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>u.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>u.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>u.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>u.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>u.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>u.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>u.RGBDepthPacking,"RGBFormat",()=>u.RGBFormat,"RGBIntegerFormat",()=>u.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>u.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>u.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>u.RGB_ETC1_Format,"RGB_ETC2_Format",()=>u.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>u.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>u.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>u.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>u.RGDepthPacking,"RGFormat",()=>u.RGFormat,"RGIntegerFormat",()=>u.RGIntegerFormat,"RawShaderMaterial",()=>u.RawShaderMaterial,"Ray",()=>u.Ray,"Raycaster",()=>u.Raycaster,"RectAreaLight",()=>u.RectAreaLight,"RedFormat",()=>u.RedFormat,"RedIntegerFormat",()=>u.RedIntegerFormat,"ReinhardToneMapping",()=>u.ReinhardToneMapping,"RenderTarget",()=>u.RenderTarget,"RenderTarget3D",()=>u.RenderTarget3D,"RepeatWrapping",()=>u.RepeatWrapping,"ReplaceStencilOp",()=>u.ReplaceStencilOp,"ReverseSubtractEquation",()=>u.ReverseSubtractEquation,"RingGeometry",()=>u.RingGeometry,"SIGNED_R11_EAC_Format",()=>u.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>u.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>u.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>u.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>u.SRGBColorSpace,"SRGBTransfer",()=>u.SRGBTransfer,"Scene",()=>u.Scene,"ShaderChunk",()=>s.ShaderChunk,"ShaderLib",()=>s.ShaderLib,"ShaderMaterial",()=>u.ShaderMaterial,"ShadowMaterial",()=>u.ShadowMaterial,"Shape",()=>u.Shape,"ShapeGeometry",()=>u.ShapeGeometry,"ShapePath",()=>u.ShapePath,"ShapeUtils",()=>u.ShapeUtils,"ShortType",()=>u.ShortType,"Skeleton",()=>u.Skeleton,"SkeletonHelper",()=>u.SkeletonHelper,"SkinnedMesh",()=>u.SkinnedMesh,"Source",()=>u.Source,"Sphere",()=>u.Sphere,"SphereGeometry",()=>u.SphereGeometry,"Spherical",()=>u.Spherical,"SphericalHarmonics3",()=>u.SphericalHarmonics3,"SplineCurve",()=>u.SplineCurve,"SpotLight",()=>u.SpotLight,"SpotLightHelper",()=>u.SpotLightHelper,"Sprite",()=>u.Sprite,"SpriteMaterial",()=>u.SpriteMaterial,"SrcAlphaFactor",()=>u.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>u.SrcAlphaSaturateFactor,"SrcColorFactor",()=>u.SrcColorFactor,"StaticCopyUsage",()=>u.StaticCopyUsage,"StaticDrawUsage",()=>u.StaticDrawUsage,"StaticReadUsage",()=>u.StaticReadUsage,"StereoCamera",()=>u.StereoCamera,"StreamCopyUsage",()=>u.StreamCopyUsage,"StreamDrawUsage",()=>u.StreamDrawUsage,"StreamReadUsage",()=>u.StreamReadUsage,"StringKeyframeTrack",()=>u.StringKeyframeTrack,"SubtractEquation",()=>u.SubtractEquation,"SubtractiveBlending",()=>u.SubtractiveBlending,"TOUCH",()=>u.TOUCH,"TangentSpaceNormalMap",()=>u.TangentSpaceNormalMap,"TetrahedronGeometry",()=>u.TetrahedronGeometry,"Texture",()=>u.Texture,"TextureLoader",()=>u.TextureLoader,"TextureUtils",()=>u.TextureUtils,"Timer",()=>u.Timer,"TimestampQuery",()=>u.TimestampQuery,"TorusGeometry",()=>u.TorusGeometry,"TorusKnotGeometry",()=>u.TorusKnotGeometry,"Triangle",()=>u.Triangle,"TriangleFanDrawMode",()=>u.TriangleFanDrawMode,"TriangleStripDrawMode",()=>u.TriangleStripDrawMode,"TrianglesDrawMode",()=>u.TrianglesDrawMode,"TubeGeometry",()=>u.TubeGeometry,"UVMapping",()=>u.UVMapping,"Uint16BufferAttribute",()=>u.Uint16BufferAttribute,"Uint32BufferAttribute",()=>u.Uint32BufferAttribute,"Uint8BufferAttribute",()=>u.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>u.Uint8ClampedBufferAttribute,"Uniform",()=>u.Uniform,"UniformsGroup",()=>u.UniformsGroup,"UniformsLib",()=>s.UniformsLib,"UniformsUtils",()=>u.UniformsUtils,"UnsignedByteType",()=>u.UnsignedByteType,"UnsignedInt101111Type",()=>u.UnsignedInt101111Type,"UnsignedInt248Type",()=>u.UnsignedInt248Type,"UnsignedInt5999Type",()=>u.UnsignedInt5999Type,"UnsignedIntType",()=>u.UnsignedIntType,"UnsignedShort4444Type",()=>u.UnsignedShort4444Type,"UnsignedShort5551Type",()=>u.UnsignedShort5551Type,"UnsignedShortType",()=>u.UnsignedShortType,"VSMShadowMap",()=>u.VSMShadowMap,"Vector2",()=>u.Vector2,"Vector3",()=>u.Vector3,"Vector4",()=>u.Vector4,"VectorKeyframeTrack",()=>u.VectorKeyframeTrack,"VideoFrameTexture",()=>u.VideoFrameTexture,"VideoTexture",()=>u.VideoTexture,"WebGL3DRenderTarget",()=>u.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>u.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>u.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>u.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>u.WebGLRenderTarget,"WebGLRenderer",()=>s.WebGLRenderer,"WebGLUtils",()=>s.WebGLUtils,"WebGPUCoordinateSystem",()=>u.WebGPUCoordinateSystem,"WebXRController",()=>u.WebXRController,"WireframeGeometry",()=>u.WireframeGeometry,"WrapAroundEnding",()=>u.WrapAroundEnding,"ZeroCurvatureEnding",()=>u.ZeroCurvatureEnding,"ZeroFactor",()=>u.ZeroFactor,"ZeroSlopeEnding",()=>u.ZeroSlopeEnding,"ZeroStencilOp",()=>u.ZeroStencilOp,"createCanvasElement",()=>u.createCanvasElement,"error",()=>u.error,"getConsoleFunction",()=>u.getConsoleFunction,"log",()=>u.log,"setConsoleFunction",()=>u.setConsoleFunction,"warn",()=>u.warn,"warnOnce",()=>u.warnOnce],32009);var c=e.i(32009);function d(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let f=["x","y","top","bottom","left","right","width","height"];var m=e.i(46791);function h({ref:e,children:t,fallback:r,resize:n,style:a,gl:s,events:u=l.f,eventSource:m,eventPrefix:h,shadows:p,linear:A,flat:g,legacy:v,orthographic:B,frameloop:C,dpr:y,performance:b,raycaster:x,camera:E,scene:M,onPointerMissed:S,onCreated:F,...T}){o.useMemo(()=>(0,l.e)(c),[]);let R=(0,l.u)(),[w,D]=function({debounce:e,scroll:t,polyfill:r,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){var i,a,l;let s=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[u,c]=(0,o.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),m=(0,o.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:u,orientationHandler:null}),h=e?"number"==typeof e?e:e.scroll:null,p=e?"number"==typeof e?e:e.resize:null,A=(0,o.useRef)(!1);(0,o.useEffect)(()=>(A.current=!0,()=>void(A.current=!1)));let[g,v,B]=(0,o.useMemo)(()=>{let e=()=>{let e,t;if(!m.current.element)return;let{left:r,top:i,width:a,height:o,bottom:l,right:s,x:u,y:d}=m.current.element.getBoundingClientRect(),h={left:r,top:i,width:a,height:o,bottom:l,right:s,x:u,y:d};m.current.element instanceof HTMLElement&&n&&(h.height=m.current.element.offsetHeight,h.width=m.current.element.offsetWidth),Object.freeze(h),A.current&&(e=m.current.lastBounds,t=h,!f.every(r=>e[r]===t[r]))&&c(m.current.lastBounds=h)};return[e,p?d(e,p):e,h?d(e,h):e]},[c,n,h,p]);function C(){m.current.scrollContainers&&(m.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",B,!0)),m.current.scrollContainers=null),m.current.resizeObserver&&(m.current.resizeObserver.disconnect(),m.current.resizeObserver=null),m.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",m.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",m.current.orientationHandler))}function y(){m.current.element&&(m.current.resizeObserver=new s(B),m.current.resizeObserver.observe(m.current.element),t&&m.current.scrollContainers&&m.current.scrollContainers.forEach(e=>e.addEventListener("scroll",B,{capture:!0,passive:!0})),m.current.orientationHandler=()=>{B()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",m.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",m.current.orientationHandler))}return i=B,a=!!t,(0,o.useEffect)(()=>{if(a)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,a]),l=v,(0,o.useEffect)(()=>(window.addEventListener("resize",l),()=>void window.removeEventListener("resize",l)),[l]),(0,o.useEffect)(()=>{C(),y()},[t,B,v]),(0,o.useEffect)(()=>C,[]),[e=>{e&&e!==m.current.element&&(C(),m.current.element=e,m.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},u,g]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=o.useRef(null),G=o.useRef(null);o.useImperativeHandle(e,()=>I.current);let L=(0,l.a)(S),[_,P]=o.useState(!1),[O,k]=o.useState(!1);if(_)throw _;if(O)throw O;let H=o.useRef(null);(0,l.b)(()=>{let e=I.current;D.width>0&&D.height>0&&e&&(H.current||(H.current=(0,l.c)(e)),async function(){await H.current.configure({gl:s,scene:M,events:u,shadows:p,linear:A,flat:g,legacy:v,orthographic:B,frameloop:C,dpr:y,performance:b,raycaster:x,camera:E,size:D,onPointerMissed:(...e)=>null==L.current?void 0:L.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(m?(0,l.i)(m)?m.current:m:G.current),h&&e.setEvents({compute:(e,t)=>{let r=e[h+"X"],n=e[h+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==F||F(e)}}),H.current.render((0,i.jsx)(R,{children:(0,i.jsx)(l.E,{set:k,children:(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(l.B,{set:P}),children:null!=t?t:null})})}))}())}),o.useEffect(()=>{let e=I.current;if(e)return()=>(0,l.d)(e)},[]);let j=m?"none":"auto";return(0,i.jsx)("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...a},...T,children:(0,i.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,i.jsx)("canvas",{ref:I,style:{display:"block"},children:r})})})}function p(e){return(0,i.jsx)(m.FiberProvider,{children:(0,i.jsx)(h,{...e})})}e.i(39695),e.i(98133),e.i(95087);var A=e.i(66027),g=e.i(54970),v=e.i(12979),B=e.i(49774),C=e.i(73949),y=e.i(62395),b=e.i(75567),x=e.i(47071);let E={value:!0},M=` -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 S=e.i(79123),F=e.i(47021),T=e.i(48066);let R={0:32,1:32,2:32,3:32,4:32,5:32};function w({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:a,lightmap:l}){let{debugMode:s}=(0,S.useDebug)(),c=(0,x.useTexture)(r.map(e=>(0,v.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,b.setupTexture)(e))}),d=a?(0,v.textureToUrl)(a):null,f=(0,x.useTexture)(d??v.FALLBACK_TEXTURE_URL,e=>{(0,b.setupTexture)(e)}),m=(0,o.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:i,detailTexture:a=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=E;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:i[r]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),a&&(e.uniforms.detailTexture={value:a},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;":""} -${o?"uniform sampler2D terrainLightmap;":""} -uniform bool sunLightPointsDown; -${a?`uniform sampler2D detailTexture; -uniform float detailTiling; -uniform float detailFadeDistance; -varying vec3 vTerrainWorldPos;`:""} - -${M} - -// 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; - - ${a?`// 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; -`),o&&(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); - - ${o?` - // 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:c,alphaTextures:n,visibilityMask:t,tiling:R,detailTexture:d?f:null,lightmap:l}),(0,F.injectCustomFog)(e,T.globalFogUniforms)},[c,n,t,f,d,l]),h=(0,o.useRef)(null);(0,o.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,i.jsx)("meshLambertMaterial",{ref:h,map:e,depthWrite:!0,side:u.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:m},p)}function D(e){let t,r,n=(0,a.c)(8),{displacementMap:l,visibilityMask:s,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f}=e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),n[0]=t):t=n[0],n[1]!==c||n[2]!==d||n[3]!==l||n[4]!==f||n[5]!==u||n[6]!==s?(r=(0,i.jsx)(o.Suspense,{fallback:t,children:(0,i.jsx)(w,{displacementMap:l,visibilityMask:s,textureNames:u,alphaTextures:c,detailTextureName:d,lightmap:f})}),n[1]=c,n[2]=d,n[3]=l,n[4]=f,n[5]=u,n[6]=s,n[7]=r):r=n[7],r}let I=(0,o.memo)(function(e){let t,r,n,o=(0,a.c)(15),{tileX:l,tileZ:s,blockSize:u,basePosition:c,textureNames:d,geometry:f,displacementMap:m,visibilityMask:h,alphaTextures:p,detailTextureName:A,lightmap:g,visible:v}=e,B=void 0===v||v,C=u/2,y=c.x+l*u+C,b=c.z+s*u+C;o[0]!==y||o[1]!==b?(t=[y,0,b],o[0]=y,o[1]=b,o[2]=t):t=o[2];let x=t;return o[3]!==p||o[4]!==A||o[5]!==m||o[6]!==g||o[7]!==d||o[8]!==h?(r=(0,i.jsx)(D,{displacementMap:m,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:A,lightmap:g}),o[3]=p,o[4]=A,o[5]=m,o[6]=g,o[7]=d,o[8]=h,o[9]=r):r=o[9],o[10]!==f||o[11]!==x||o[12]!==r||o[13]!==B?(n=(0,i.jsx)("mesh",{position:x,geometry:f,castShadow:!0,receiveShadow:!0,visible:B,children:r}),o[10]=f,o[11]=x,o[12]=r,o[13]=B,o[14]=n):n=o[14],n});var G=e.i(77482);function L(e){let t,r=(0,a.c)(3),n=(0,G.useRuntime)();return r[0]!==e||r[1]!==n?(t=n.getObjectByName(e),r[0]=e,r[1]=n,r[2]=t):t=r[2],t}function _(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r0?n:(t[0]!==r?(e=(0,y.getFloat)(r,"visibleDistance")??600,t[0]=r,t[1]=e):e=t[1],e)}(),V=(0,C.useThree)(O),X=-(128*N);D[6]!==X?(l={x:X,z:X},D[6]=X,D[7]=l):l=D[7];let q=l;if(D[8]!==G){let e=(0,y.getProperty)(G,"emptySquares");s=e?e.split(" ").map(k):[],D[8]=G,D[9]=s}else s=D[9];let W=s,{data:Y}=((w=(0,a.c)(2))[0]!==P?(R={queryKey:["terrain",P],queryFn:()=>(0,v.loadTerrain)(P)},w[0]=P,w[1]=R):R=w[1],(0,A.useQuery)(R));e:{let e;if(!Y){c=null;break e}let t=256*N;D[10]!==t||D[11]!==N||D[12]!==Y.heightMap?(!function(e,t,r){let n=e.attributes.position,i=e.attributes.uv,a=e.attributes.normal,o=n.array,l=i.array,s=a.array,u=n.count,c=(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))),i=Math.floor(r=Math.max(0,Math.min(255,r))),a=Math.min(n+1,255),o=Math.min(i+1,255),l=e-n,s=r-i;return(t[256*i+n]/65535*2048*(1-l)+t[256*i+a]/65535*2048*l)*(1-s)+(t[256*o+n]/65535*2048*(1-l)+t[256*o+a]/65535*2048*l)*s};for(let e=0;e0?(h/=g,p/=g,A/=g):(h=0,p=1,A=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=A}n.needsUpdate=!0,a.needsUpdate=!0}(e=function(e,t){let r=new u.BufferGeometry,n=new Float32Array(198147),i=new Float32Array(198147),a=new Float32Array(132098),o=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let o=257*t+r;n[3*o]=r*s-e/2,n[3*o+1]=e/2-t*s,n[3*o+2]=0,i[3*o]=0,i[3*o+1]=0,i[3*o+2]=1,a[2*o]=r/256,a[2*o+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,i=(e+1)*257+t,a=i+1;((t^e)&1)==0?(o[l++]=r,o[l++]=i,o[l++]=a,o[l++]=r,o[l++]=a,o[l++]=n):(o[l++]=r,o[l++]=i,o[l++]=n,o[l++]=n,o[l++]=i,o[l++]=a)}return r.setIndex(new u.BufferAttribute(o,1)),r.setAttribute("position",new u.Float32BufferAttribute(n,3)),r.setAttribute("normal",new u.Float32BufferAttribute(i,3)),r.setAttribute("uv",new u.Float32BufferAttribute(a,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),Y.heightMap,N),D[10]=t,D[11]=N,D[12]=Y.heightMap,D[13]=e):e=D[13],c=e}let z=c,Z=L("Sun");t:{let e,t;if(!Z){let e;D[14]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3(.57735,-.57735,.57735),D[14]=e):e=D[14],d=e;break t}D[15]!==Z?(e=((0,y.getProperty)(Z,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(H),D[15]=Z,D[16]=e):e=D[16];let[r,n,i]=e,a=Math.sqrt(r*r+i*i+n*n),o=r/a,l=i/a,s=n/a;D[17]!==l||D[18]!==s||D[19]!==o?(t=new u.Vector3(o,l,s),D[17]=l,D[18]=s,D[19]=o,D[20]=t):t=D[20],d=t}let $=d;r:{let e;if(!Y){f=null;break r}D[21]!==N||D[22]!==$||D[23]!==Y.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),i=Math.max(0,Math.min(255,r)),a=Math.floor(n),o=Math.floor(i),l=Math.min(a+1,255),s=Math.min(o+1,255),u=n-a,c=i-o;return((e[256*o+a]/65535*(1-u)+e[256*o+l]/65535*u)*(1-c)+(e[256*s+a]/65535*(1-u)+e[256*s+l]/65535*u)*c)*2048},i=new u.Vector3(-t.x,-t.y,-t.z).normalize(),a=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,l=e/2+.25,s=n(o,l),u=n(o-.5,l),c=n(o+.5,l),d=n(o,l-.5),f=-((n(o,l+.5)-d)/1),m=-((c-u)/1),h=Math.sqrt(f*f+r*r+m*m),p=Math.max(0,f/h*i.x+r/h*i.y+m/h*i.z),A=1;p>0&&(A=function(e,t,r,n,i,a){let o=n.z/i,l=n.x/i,s=n.y,u=Math.sqrt(o*o+l*l);if(u<1e-4)return 1;let c=.5/u,d=o*c,f=l*c,m=s*c,h=e,p=t,A=r+.1;for(let e=0;e<768&&(h+=d,p+=f,A+=m,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(A>2048));e++)if(AArray(eo).fill(null),D[34]=eo,D[35]=x):x=D[35];let[es,eu]=(0,o.useState)(x);D[36]===Symbol.for("react.memo_cache_sentinel")?(E={xStart:0,xEnd:0,zStart:0,zEnd:0},D[36]=E):E=D[36];let ec=(0,o.useRef)(E);return(D[37]!==q.x||D[38]!==q.z||D[39]!==K||D[40]!==V.position.x||D[41]!==V.position.z||D[42]!==eo||D[43]!==Q?(M=()=>{let e=V.position.x-q.x,t=V.position.z-q.z,r=Math.floor((e-Q)/K),n=Math.ceil((e+Q)/K),i=Math.floor((t-Q)/K),a=Math.ceil((t+Q)/K),o=ec.current;if(r===o.xStart&&n===o.xEnd&&i===o.zStart&&a===o.zEnd)return;o.xStart=r,o.xEnd=n,o.zStart=i,o.zEnd=a;let l=[];for(let e=r;e{let t=es[e];return(0,i.jsx)(I,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:K,basePosition:q,textureNames:Y.textureNames,geometry:z,displacementMap:et,visibilityMask:en,alphaTextures:ei,detailTextureName:J,lightmap:ee,visible:null!==t},e)}),D[55]=q,D[56]=K,D[57]=J,D[58]=el,D[59]=ei,D[60]=et,D[61]=z,D[62]=Y.textureNames,D[63]=ee,D[64]=es,D[65]=F):F=D[65],D[66]!==S||D[67]!==F?(T=(0,i.jsxs)(i.Fragment,{children:[S,F]}),D[66]=S,D[67]=F,D[68]=T):T=D[68],T):null});function O(e){return e.camera}function k(e){return parseInt(e,10)}function H(e){return parseFloat(e)}function j(e){return(0,b.setupMask)(e)}function U(e,t){return t}let N=(0,o.createContext)(null);function J(){return(0,o.useContext)(N)}function K(e,t){return(0,i.jsx)(t$,{object:e},e._id)}var Q=o;let V=(0,Q.createContext)(null),X={didCatch:!1,error:null};class q extends Q.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=X}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(X))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;r&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(this.props.onReset?.({next:n,prev:e.resetKeys,reason:"keys"}),this.setState(X))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,Q.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,Q.createElement)(V.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}var W=e.i(31067),Y=u;function z(e,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==u.TriangleFanDrawMode&&t!==u.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let l=new eK(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}}function en(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let ei={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ea{constructor(e){this.parser=e,this.name=ei.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,a)}}class eB{constructor(e){this.parser=e,this.name=ei.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],l=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(l=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,l);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class eC{constructor(e){this.parser=e,this.name=ei.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],l=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(l=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,l);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class ey{constructor(e){this.name=ei.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let r=e.byteOffset||0,n=e.byteLength||0,a=e.count,o=e.byteStride,l=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,l,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,l,e.mode,e.filter),t})})}}}class eb{constructor(e){this.name=ei.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==eD.TRIANGLES&&e.mode!==eD.TRIANGLE_STRIP&&e.mode!==eD.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of r){let t=new Y.Matrix4,r=new Y.Vector3,o=new Y.Quaternion,l=new Y.Vector3(1,1,1),s=new Y.InstancedMesh(e.geometry,e.material,n);for(let e=0;e=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},eO={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ek={CUBICSPLINE:void 0,LINEAR:Y.InterpolateLinear,STEP:Y.InterpolateDiscrete};function eH(e,t,r){for(let n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ej(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function eU(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new Y.TextureLoader(this.options.manager):this.textureLoader=new Y.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Y.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};return eH(i,a,n),ej(a,n),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,n=t.length;r{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,t.children[n])};return i(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&a.setY(t,d[e*l+1]),l>=3&&a.setZ(t,d[e*l+2]),l>=4&&a.setW(t,d[e*l+3]),l>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];let s=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=eG[r.magFilter]||Y.LinearFilter,t.minFilter=eG[r.minFilter]||Y.LinearMipmapLinearFilter,t.wrapS=eL[r.wrapS]||Y.RepeatWrapping,t.wrapT=eL[r.wrapT]||Y.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[l]=s,s}loadImageSource(e,t){let r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=r.images[e],a=self.URL||self.webkitURL,o=i.uri||"",l=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){l=!0;let t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let s=Promise.resolve(o).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new Y.Texture(e);t.needsUpdate=!0,r(t)}),t.load(Y.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(o),ej(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=s,s}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[ei.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[ei.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[ei.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?ee:et),"colorSpace"in a?a.colorSpace=n:a.encoding=n===ee?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new Y.PointsMaterial,Y.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new Y.LineBasicMaterial,Y.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(n||i||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return Y.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},l=a.extensions||{},s=[];if(l[ei.KHR_MATERIALS_UNLIT]){let e=i[ei.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),s.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new Y.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],et),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(r.assignTexture(o,"map",n.baseColorTexture,ee)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(r.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(r.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=Y.DoubleSide);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==Y.MeshBasicMaterial&&(s.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new Y.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==Y.MeshBasicMaterial&&(s.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==Y.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new Y.Color().setRGB(e[0],e[1],e[2],et)}return void 0!==a.emissiveTexture&&t!==Y.MeshBasicMaterial&&s.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,ee)),Promise.all(s).then(function(){let n=new t(o);return a.name&&(n.name=a.name),ej(n,a),r.associations.set(n,{materials:e}),a.extensions&&eH(i,n,a),n})}createUniqueName(e){let t=Y.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,n=this.primitiveCache,i=[];for(let a=0,o=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r1?new Y.Group:1===t.length?t[0]:new Y.Object3D)!==t[0])for(let e=0,r=t.length;e{let t=new Map;for(let[e,r]of n.associations)(e instanceof Y.Material||e instanceof Y.Texture)&&t.set(e,r);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,r,n,i){let a,o=[],l=e.name?e.name:e.uuid,s=[];switch(eO[i.path]===eO.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(l),eO[i.path]){case eO.weights:a=Y.NumberKeyframeTrack;break;case eO.rotation:a=Y.QuaternionKeyframeTrack;break;case eO.position:case eO.scale:a=Y.VectorKeyframeTrack;break;default:a=1===r.itemSize?Y.NumberKeyframeTrack:Y.VectorKeyframeTrack}let u=void 0!==n.interpolation?ek[n.interpolation]:Y.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=s.length;e{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let n=JSON.stringify(t);if(eX.has(e)){let t=eX.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),eX.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new eV.BufferGeometry;e.index&&t.setIndex(new eV.BufferAttribute(e.index.array,1));for(let r=0;r{r.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=eW.toString(),i=["/* draco decoder */",r,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){var i,a,o;let l,s,u,c,d,f,m=n.attributeIDs,h=n.attributeTypes,p=t.GetEncodedGeometryType(r);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(p===e.POINT_CLOUD)d=new e.PointCloud,f=t.DecodeBufferToPointCloud(r,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let A={index:null,attributes:[]};for(let r in m){let i,a,o=self[h[r]];if(n.useUniqueIDs)a=m[r],i=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[m[r]])))continue;i=t.GetAttribute(d,a)}A.attributes.push(function(e,t,r,n,i,a){let o=a.num_components(),l=r.num_points()*o,s=l*i.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(s);t.GetAttributeDataArrayForAllPoints(r,a,u,s,c);let d=new i(e.HEAPF32.buffer,c,l).slice();return e._free(c),{name:n,array:d,itemSize:o}}(e,t,d,r,o,i))}return p===e.TRIANGULAR_MESH&&(i=e,a=t,o=d,l=3*o.num_faces(),s=4*l,u=i._malloc(s),a.GetTrianglesUInt32Array(o,s,u),c=new Uint32Array(i.HEAPF32.buffer,u,l).slice(),i._free(u),A.index={array:c,itemSize:1}),e.destroy(d),A}(t,r,o,a),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}var eY=e.i(971);let ez=function(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;i{let f={keys:s,deep:n,inject:l,castShadow:i,receiveShadow:a};if(Array.isArray(t=o.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return ez(t)}return t},[t,e])))return o.createElement("group",(0,W.default)({},c,{ref:d}),t.map(e=>o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f))),r);let{children:m,...h}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:n,castShadow:i,receiveShadow:a}){let l={};for(let r of t)l[r]=e[r];return r&&(l.geometry&&"materialsOnly"!==r&&(l.geometry=l.geometry.clone()),l.material&&"geometriesOnly"!==r&&(l.material=l.material.clone())),n&&(l="function"==typeof n?{...l,children:n(e)}:o.isValidElement(n)?{...l,children:n}:{...l,...n}),e instanceof u.Mesh&&(i&&(l.castShadow=!0),a&&(l.receiveShadow=!0)),l}(t,f),p=t.type[0].toLowerCase()+t.type.slice(1);return o.createElement(p,(0,W.default)({},h,c,{ref:d}),t.children.map(e=>"Bone"===e.type?o.createElement("primitive",(0,W.default)({key:e.uuid,object:e},f)):o.createElement(eZ,(0,W.default)({key:e.uuid,object:e},f,{isChild:!0}))),r,m)}),e$=null,e0="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function e1(e=!0,r=!0,n){return i=>{n&&n(i),e&&(e$||(e$=new eq),e$.setDecoderPath("string"==typeof e?e:e0),i.setDRACOLoader(e$)),r&&i.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(r)&&(i="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,n,i,a,o){let l=e.exports.sbrk,s=n+3&-4,u=l(s*i),c=l(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&o&&o(u,s,i),r.set(d.subarray(u,u+n*i)),l(u-l(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}let l={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[l[a]])},decodeIndexBuffer(t,r,n,i){o(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){o(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){o(e.exports[s[a]],t,r,n,i,e.exports[l[u]])}}})())}}let e2=(e,t,r,n)=>(0,eY.useLoader)(er,e,e1(t,r,n));e2.preload=(e,t,r,n)=>eY.useLoader.preload(er,e,e1(t,r,n)),e2.clear=e=>eY.useLoader.clear(er,e),e2.setDecoderPath=e=>{e0=e};var e9=e.i(89887);let e3=` -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); -} -`;function e5({materialName:e,material:t,lightMap:r}){let n=(0,S.useDebug)(),a=n?.debugMode??!1,l=(0,v.textureToUrl)(e),s=(0,x.useTexture)(l,e=>(0,b.setupTexture)(e)),c=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),f=(0,o.useCallback)(e=>{let t;(0,F.injectCustomFog)(e,T.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new u.Vector3(0,.4,1):new u.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include ",`#include -${e3} -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]),m=(0,o.useRef)(null),h=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=m.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!a,e.needsUpdate=!0)},[a]);let p={DEBUG_MODE:+!!a},A=`${d}`;return c?(0,i.jsx)("meshBasicMaterial",{ref:m,map:s,toneMapped:!1,defines:p,onBeforeCompile:f},A):(0,i.jsx)("meshLambertMaterial",{ref:h,map:s,lightMap:r,toneMapped:!1,defines:p,onBeforeCompile:f},A)}function e8(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=u.SRGBColorSpace),t??null}function e6(e){let t,r,n,l=(0,a.c)(13),{node:s}=e;e:{let e,r;if(!s.material){let e;l[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],l[0]=e):e=l[0],t=e;break e}if(Array.isArray(s.material)){let e;l[1]!==s.material?(e=s.material.map(e4),l[1]=s.material,l[2]=e):e=l[2],t=e;break e}l[3]!==s.material?(e=e8(s.material),l[3]=s.material,l[4]=e):e=l[4],l[5]!==e?(r=[e],l[5]=e,l[6]=r):r=l[6],t=r}let u=t;return l[7]!==u||l[8]!==s.material?(r=s.material?(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(s.material)?s.material.map((e,t)=>(0,i.jsx)(e5,{materialName:e.userData.resource_path,material:e,lightMap:u[t]},t)):(0,i.jsx)(e5,{materialName:s.material.userData.resource_path,material:s.material,lightMap:u[0]})}):null,l[7]=u,l[8]=s.material,l[9]=r):r=l[9],l[10]!==s.geometry||l[11]!==r?(n=(0,i.jsx)("mesh",{geometry:s.geometry,castShadow:!0,receiveShadow:!0,children:r}),l[10]=s.geometry,l[11]=r,l[12]=n):n=l[12],n}function e4(e){return e8(e)}let e7=(0,o.memo)(function(e){let t,r,n,o,l,s,u=(0,a.c)(10),{object:c,interiorFile:d}=e,{nodes:f}=((s=(0,a.c)(2))[0]!==d?(l=(0,v.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],e2(l)),m=(0,S.useDebug)(),h=m?.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?(r=Object.entries(f).filter(tn).map(ti),u[1]=f,u[2]=r):r=u[2],u[3]!==h||u[4]!==d||u[5]!==c?(n=h?(0,i.jsxs)(e9.FloatingLabel,{children:[c._id,": ",d]}):null,u[3]=h,u[4]=d,u[5]=c,u[6]=n):n=u[6],u[7]!==r||u[8]!==n?(o=(0,i.jsxs)("group",{rotation:t,children:[r,n]}),u[7]=r,u[8]=n,u[9]=o):o=u[9],o});function te(e){let t,r,n,o,l=(0,a.c)(9),{color:s,label:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(r=(0,i.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=r):r=l[2],l[3]!==s||l[4]!==u?(n=u?(0,i.jsx)(e9.FloatingLabel,{color:s,children:u}):null,l[3]=s,l[4]=u,l[5]=n):n=l[5],l[6]!==r||l[7]!==n?(o=(0,i.jsxs)("mesh",{children:[t,r,n]}),l[6]=r,l[7]=n,l[8]=o):o=l[8],o}function tt(e){let t,r=(0,a.c)(3),{label:n}=e,o=(0,S.useDebug)(),l=o?.debugMode??!1;return r[0]!==l||r[1]!==n?(t=l?(0,i.jsx)(te,{color:"red",label:n}):null,r[0]=l,r[1]=n,r[2]=t):t=r[2],t}let tr=(0,o.memo)(function(e){let t,r,n,l,s,u,c,d,f,m=(0,a.c)(22),{object:h}=e;m[0]!==h?(t=(0,y.getProperty)(h,"interiorFile"),m[0]=h,m[1]=t):t=m[1];let p=t;m[2]!==h?(r=(0,y.getPosition)(h),m[2]=h,m[3]=r):r=m[3];let A=r;m[4]!==h?(n=(0,y.getScale)(h),m[4]=h,m[5]=n):n=m[5];let g=n;m[6]!==h?(l=(0,y.getRotation)(h),m[6]=h,m[7]=l):l=m[7];let v=l,B=`${h._id}: ${p}`;return m[8]!==B?(s=(0,i.jsx)(tt,{label:B}),m[8]=B,m[9]=s):s=m[9],m[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,i.jsx)(te,{color:"orange"}),m[10]=u):u=m[10],m[11]!==p||m[12]!==h?(c=(0,i.jsx)(o.Suspense,{fallback:u,children:(0,i.jsx)(e7,{object:h,interiorFile:p})}),m[11]=p,m[12]=h,m[13]=c):c=m[13],m[14]!==s||m[15]!==c?(d=(0,i.jsx)(q,{fallback:s,children:c}),m[14]=s,m[15]=c,m[16]=d):d=m[16],m[17]!==A||m[18]!==v||m[19]!==g||m[20]!==d?(f=(0,i.jsx)("group",{position:A,quaternion:v,scale:g,children:d}),m[17]=A,m[18]=v,m[19]=g,m[20]=d,m[21]=f):f=m[21],f});function tn(e){let[,t]=e;return t.isMesh}function ti(e){let[t,r]=e;return(0,i.jsx)(e6,{node:r},t)}function ta(e,{path:t}){let[r]=(0,eY.useLoader)(u.CubeTextureLoader,[e],e=>e.setPath(t));return r}ta.preload=(e,{path:t})=>eY.useLoader.preload(u.CubeTextureLoader,[e],e=>e.setPath(t));let to=()=>{};function tl(e){return e.wrapS=u.RepeatWrapping,e.wrapT=u.RepeatWrapping,e.minFilter=u.LinearFilter,e.magFilter=u.LinearFilter,e.colorSpace=u.NoColorSpace,e.needsUpdate=!0,e}let ts=` - 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; - } -`,tu=` - 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 tc({textureUrl:e,radius:t,heightPercent:r,speed:n,windDirection:a,layerIndex:l}){let{debugMode:s}=(0,S.useDebug)(),{animationEnabled:c}=(0,S.useSettings)(),d=(0,o.useRef)(null),f=(0,x.useTexture)(e,tl),m=(0,o.useMemo)(()=>{let e=r-.05;return function(e,t,r,n){var i;let a,o,l,s,c,d,f,m,h,p,A,g,v,B,C,y,b,x=new u.BufferGeometry,E=new Float32Array(75),M=new Float32Array(50),S=[.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],F=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*F,a=e-t*F,o=e*S[n];E[3*n]=i,E[3*n+1]=o,E[3*n+2]=a,M[2*n]=r,M[2*n+1]=t}i=E,a=e=>({x:i[3*e],y:i[3*e+1],z:i[3*e+2]}),o=(e,t,r,n)=>{i[3*e]=t,i[3*e+1]=r,i[3*e+2]=n},l=a(1),s=a(3),c=a(5),d=a(6),f=a(8),m=a(9),h=a(15),p=a(16),A=a(18),g=a(19),v=a(21),B=a(23),C=c.x+(l.x-c.x)*.5,y=c.y+(l.y-c.y)*.5,b=c.z+(l.z-c.z)*.5,o(0,d.x+(C-d.x)*2,d.y+(y-d.y)*2,d.z+(b-d.z)*2),C=m.x+(s.x-m.x)*.5,y=m.y+(s.y-m.y)*.5,b=m.z+(s.z-m.z)*.5,o(4,f.x+(C-f.x)*2,f.y+(y-f.y)*2,f.z+(b-f.z)*2),C=v.x+(h.x-v.x)*.5,y=v.y+(h.y-v.y)*.5,b=v.z+(h.z-v.z)*.5,o(20,p.x+(C-p.x)*2,p.y+(y-p.y)*2,p.z+(b-p.z)*2),C=B.x+(g.x-B.x)*.5,y=B.y+(g.y-B.y)*.5,b=B.z+(g.z-B.z)*.5,o(24,A.x+(C-A.x)*2,A.y+(y-A.y)*2,A.z+(b-A.z)*2);let T=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(E,e),R=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;R.push(r,i,a),R.push(r,a,n)}return x.setIndex(R),x.setAttribute("position",new u.Float32BufferAttribute(E,3)),x.setAttribute("uv",new u.Float32BufferAttribute(M,2)),x.setAttribute("alpha",new u.Float32BufferAttribute(T,1)),x.computeBoundingSphere(),x}(t,r,e,0)},[t,r]);(0,o.useEffect)(()=>()=>{m.dispose()},[m]);let h=(0,o.useMemo)(()=>new u.ShaderMaterial({uniforms:{cloudTexture:{value:f},uvOffset:{value:new u.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:ts,fragmentShader:tu,transparent:!0,depthWrite:!1,side:u.DoubleSide}),[f,s,l]);return(0,o.useEffect)(()=>()=>{h.dispose()},[h]),(0,B.useFrame)(c?(e,t)=>{let r=1e3*t/32;d.current??=new u.Vector2(0,0),d.current.x+=a.x*n*r,d.current.y+=a.y*n*r,d.current.x-=Math.floor(d.current.x),d.current.y-=Math.floor(d.current.y),h.uniforms.uvOffset.value.copy(d.current)}:to),(0,i.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,i.jsx)("primitive",{object:h,attach:"material"})})}function td(e){var t;let r,n,l,s,c,d,f,m,h,p,g,C,b,x,E,M,S,F,T,R=(0,a.c)(37),{object:w}=e;R[0]!==w?(r=(0,y.getProperty)(w,"materialList"),R[0]=w,R[1]=r):r=R[1];let{data:D}=(t=r,(F=(0,a.c)(7))[0]!==t?(E=["detailMapList",t],M=()=>(0,v.loadDetailMapList)(t),F[0]=t,F[1]=E,F[2]=M):(E=F[1],M=F[2]),T=!!t,F[3]!==E||F[4]!==M||F[5]!==T?(S={queryKey:E,queryFn:M,enabled:T},F[3]=E,F[4]=M,F[5]=T,F[6]=S):S=F[6],(0,A.useQuery)(S));R[2]!==w?(n=(0,y.getFloat)(w,"visibleDistance")??500,R[2]=w,R[3]=n):n=R[3];let I=.95*n;R[4]!==w?(l=(0,y.getFloat)(w,"cloudSpeed1")??1e-4,R[4]=w,R[5]=l):l=R[5],R[6]!==w?(s=(0,y.getFloat)(w,"cloudSpeed2")??2e-4,R[6]=w,R[7]=s):s=R[7],R[8]!==w?(c=(0,y.getFloat)(w,"cloudSpeed3")??3e-4,R[8]=w,R[9]=c):c=R[9],R[10]!==l||R[11]!==s||R[12]!==c?(d=[l,s,c],R[10]=l,R[11]=s,R[12]=c,R[13]=d):d=R[13];let G=d;R[14]!==w?(f=(0,y.getFloat)(w,"cloudHeightPer1")??.35,R[14]=w,R[15]=f):f=R[15],R[16]!==w?(m=(0,y.getFloat)(w,"cloudHeightPer2")??.25,R[16]=w,R[17]=m):m=R[17],R[18]!==w?(h=(0,y.getFloat)(w,"cloudHeightPer3")??.2,R[18]=w,R[19]=h):h=R[19],R[20]!==f||R[21]!==m||R[22]!==h?(p=[f,m,h],R[20]=f,R[21]=m,R[22]=h,R[23]=p):p=R[23];let L=p;if(R[24]!==w){e:{let e,t=(0,y.getProperty)(w,"windVelocity");if(t){let[e,r]=t.split(" ").map(tf);if(0!==e||0!==r){g=new u.Vector2(r,-e).normalize();break e}}R[26]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector2(1,0),R[26]=e):e=R[26],g=e}R[24]=w,R[25]=g}else g=R[25];let _=g;t:{let e;if(!D){let e;R[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],R[27]=e):e=R[27],C=e;break t}if(R[28]!==L||R[29]!==G||R[30]!==D){e=[];for(let t=0;t<3;t++){let r=D[7+t];r&&e.push({texture:r,height:L[t],speed:G[t]})}R[28]=L,R[29]=G,R[30]=D,R[31]=e}else e=R[31];C=e}let P=C,O=(0,o.useRef)(null);return(R[32]===Symbol.for("react.memo_cache_sentinel")?(b=e=>{let{camera:t}=e;O.current&&O.current.position.copy(t.position)},R[32]=b):b=R[32],(0,B.useFrame)(b),P&&0!==P.length)?(R[33]!==P||R[34]!==I||R[35]!==_?(x=(0,i.jsx)("group",{ref:O,children:P.map((e,t)=>{let r=(0,v.textureToUrl)(e.texture);return(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(tc,{textureUrl:r,radius:I,heightPercent:e.height,speed:e.speed,windDirection:_,layerIndex:t})},t)})}),R[33]=P,R[34]=I,R[35]=_,R[36]=x):x=R[36],x):null}function tf(e){return parseFloat(e)}let tm=!1;function th(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new u.Color().setRGB(t,r,n),new u.Color().setRGB(t,r,n).convertSRGBToLinear()]}function tp({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:n}=(0,C.useThree)(),a=ta(e,{path:""}),l=!!t,s=(0,o.useMemo)(()=>n.projectionMatrixInverse,[n]),c=(0,o.useMemo)(()=>r?(0,T.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),d=(0,o.useRef)({skybox:{value:a},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:T.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),f=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,o.useEffect)(()=>{d.current.skybox.value=a,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=l,d.current.fogVolumeData.value=c,d.current.horizonFogHeight.value=f},[a,t,l,c,f]),(0,i.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,i.jsxs)("bufferGeometry",{children:[(0,i.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,i.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,i.jsx)("shaderMaterial",{uniforms:d.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 tA(e){let t,r,n,o,l=(0,a.c)(6),{materialList:s,fogColor:u,fogState:c}=e,{data:d}=((o=(0,a.c)(2))[0]!==s?(n={queryKey:["detailMapList",s],queryFn:()=>(0,v.loadDetailMapList)(s)},o[0]=s,o[1]=n):n=o[1],(0,A.useQuery)(n));l[0]!==d?(t=d?[(0,v.textureToUrl)(d[1]),(0,v.textureToUrl)(d[3]),(0,v.textureToUrl)(d[4]),(0,v.textureToUrl)(d[5]),(0,v.textureToUrl)(d[0]),(0,v.textureToUrl)(d[2])]:null,l[0]=d,l[1]=t):t=l[1];let f=t;return f?(l[2]!==u||l[3]!==c||l[4]!==f?(r=(0,i.jsx)(tp,{skyBoxFiles:f,fogColor:u,fogState:c}),l[2]=u,l[3]=c,l[4]=f,l[5]=r):r=l[5],r):null}function tg({skyColor:e,fogColor:t,fogState:r}){let{camera:n}=(0,C.useThree)(),a=!!t,l=(0,o.useMemo)(()=>n.projectionMatrixInverse,[n]),s=(0,o.useMemo)(()=>r?(0,T.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),c=(0,o.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),d=(0,o.useRef)({skyColor:{value:e},fogColor:{value:t??new u.Color(0,0,0)},enableFog:{value:a},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:T.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,o.useEffect)(()=>{d.current.skyColor.value=e,d.current.fogColor.value=t??new u.Color(0,0,0),d.current.enableFog.value=a,d.current.fogVolumeData.value=s,d.current.horizonFogHeight.value=c},[e,t,a,s,c]),(0,i.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,i.jsxs)("bufferGeometry",{children:[(0,i.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,i.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,i.jsx)("shaderMaterial",{uniforms:d.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 tv(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function tB({fogState:e,enabled:t}){let{scene:r,camera:n}=(0,C.useThree)(),i=(0,o.useRef)(null),a=(0,o.useMemo)(()=>(0,T.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,o.useEffect)(()=>{tm||((0,F.installCustomFogShader)(),tm=!0)},[]),(0,o.useEffect)(()=>{(0,T.resetGlobalFogUniforms)();let[t,o]=tv(e,n.position.y),l=new u.Fog(e.fogColor,t,o);return r.fog=l,i.current=l,(0,T.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,T.resetGlobalFogUniforms)()}},[r,n,e,a]),(0,o.useEffect)(()=>{let r=i.current;if(r)if(t){let[t,i]=tv(e,n.position.y);r.near=t,r.far=i}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,B.useFrame)(()=>{let r=i.current;if(!r)return;let o=n.position.y;if((0,T.updateGlobalFogUniforms)(o,a,t),t){let[t,n]=tv(e,o);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}function tC(e){return parseFloat(e)}function ty(e){return parseFloat(e)}function tb(e){return parseFloat(e)}let tx=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function tE(e){return tx.test(e)}let tM=(0,o.createContext)(null);function tS(){let e=(0,o.useContext)(tM);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function tF(e){let t,r,n,o=(0,a.c)(10),{children:l,object:s,shapeName:u,type:c}=e;o[0]!==u?(t=tE(u),o[0]=u,o[1]=t):t=o[1];let d=t;o[2]!==d||o[3]!==s||o[4]!==u||o[5]!==c?(r={object:s,shapeName:u,type:c,isOrganic:d},o[2]=d,o[3]=s,o[4]=u,o[5]=c,o[6]=r):r=o[6];let f=r;return o[7]!==l||o[8]!==f?(n=(0,i.jsx)(tM.Provider,{value:f,children:l}),o[7]=l,o[8]=f,o[9]=n):n=o[9],n}e.i(47167);var tT=e.i(69230),tR=e.i(69637),tw=e.i(54440),tD=e.i(51475);let tI=new Map;function tG(e){e.onBeforeCompile=t=>{(0,F.injectCustomFog)(t,T.globalFogUniforms),e instanceof u.MeshLambertMaterial&&(t.uniforms.shapeDirectionalFactor={value:1},t.uniforms.shapeAmbientFactor={value:1.5},t.fragmentShader=t.fragmentShader.replace("#include ",`#include -uniform float shapeDirectionalFactor; -uniform float shapeAmbientFactor; -`),t.fragmentShader=t.fragmentShader.replace("#include ",`#include - // Apply shape-specific lighting multipliers - reflectedLight.directDiffuse *= shapeDirectionalFactor; - reflectedLight.indirectDiffuse *= shapeAmbientFactor; -`))}}function tL(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive");if(r.has("SelfIlluminating")){let e=new u.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,fog:!0,...a&&{blending:u.AdditiveBlending}});return tG(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new u.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new u.MeshLambertMaterial({...e,side:0});return tG(r),tG(n),[r,n]}let o=new u.MeshLambertMaterial({map:t,side:2,reflectivity:0});return tG(o),o}let t_=(0,o.memo)(function(e){let t,r,n,o,l,s,c=(0,a.c)(35),{material:d,shapeName:f,geometry:m,backGeometry:h,castShadow:p,receiveShadow:A}=e,g=void 0!==p&&p,B=void 0!==A&&A,C=d.userData.resource_path;c[0]!==d.userData.flag_names?(t=d.userData.flag_names??[],c[0]=d.userData.flag_names,c[1]=t):t=c[1],c[2]!==t?(r=new Set(t),c[2]=t,c[3]=r):r=c[3];let y=r,b=function(e){var t,r;let n,i,o,l,s=(0,a.c)(14),{animationEnabled:c}=(0,S.useSettings)();s[0]!==e?(n={queryKey:["ifl",e],queryFn:()=>(0,v.loadImageFrameList)(e)},s[0]=e,s[1]=n):n=s[1];let{data:d}=(t=n,(0,tR.useBaseQuery)({...t,enabled:!0,suspense:!0,throwOnError:tw.defaultThrowOnError,placeholderData:void 0},tT.QueryObserver,void 0));if(s[2]!==d||s[3]!==e){let t;s[5]!==e?(t=t=>(0,v.iflTextureToUrl)(t.name,e),s[5]=e,s[6]=t):t=s[6],i=d.map(t),s[2]=d,s[3]=e,s[4]=i}else i=s[4];let f=i,m=(0,x.useTexture)(f);if(s[7]!==d||s[8]!==e||s[9]!==m){let t;if(!(o=tI.get(e))){let t,r,n,i,a,l,s,c,d;r=(t=m[0].image).width,n=t.height,a=Math.ceil(Math.sqrt(i=m.length)),l=Math.ceil(i/a),(s=document.createElement("canvas")).width=r*a,s.height=n*l,c=s.getContext("2d"),m.forEach((e,t)=>{let i=Math.floor(t/a);c.drawImage(e.image,t%a*r,i*n)}),(d=new u.CanvasTexture(s)).colorSpace=u.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=u.NearestFilter,d.magFilter=u.NearestFilter,d.wrapS=u.ClampToEdgeWrapping,d.wrapT=u.ClampToEdgeWrapping,d.repeat.set(1/a,1/l),o={texture:d,columns:a,rows:l,frameCount:i,frameStartTicks:[],totalTicks:0,lastFrame:-1},tI.set(e,o)}t=0,(r=o).frameStartTicks=d.map(e=>{let r=t;return t+=e.frameCount,r}),r.totalTicks=t,s[7]=d,s[8]=e,s[9]=m,s[10]=o}else o=s[10];let h=o;return s[11]!==c||s[12]!==h?(l=e=>{let t=c?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(h,e):0;!function(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,n=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,n/e.rows)}(h,t)},s[11]=c,s[12]=h,s[13]=l):l=s[13],(0,tD.useTick)(l),h.texture}(`textures/${C}.ifl`);c[4]!==f?(n=f&&tE(f),c[4]=f,c[5]=n):n=c[5];let E=n;c[6]!==y||c[7]!==E||c[8]!==d||c[9]!==b?(o=tL(d,b,y,E),c[6]=y,c[7]=E,c[8]=d,c[9]=b,c[10]=o):o=c[10];let M=o;if(Array.isArray(M)){let e,t,r,n,a,o=h||m;return c[11]!==M[0]?(e=(0,i.jsx)("primitive",{object:M[0],attach:"material"}),c[11]=M[0],c[12]=e):e=c[12],c[13]!==g||c[14]!==B||c[15]!==o||c[16]!==e?(t=(0,i.jsx)("mesh",{geometry:o,castShadow:g,receiveShadow:B,children:e}),c[13]=g,c[14]=B,c[15]=o,c[16]=e,c[17]=t):t=c[17],c[18]!==M[1]?(r=(0,i.jsx)("primitive",{object:M[1],attach:"material"}),c[18]=M[1],c[19]=r):r=c[19],c[20]!==g||c[21]!==m||c[22]!==B||c[23]!==r?(n=(0,i.jsx)("mesh",{geometry:m,castShadow:g,receiveShadow:B,children:r}),c[20]=g,c[21]=m,c[22]=B,c[23]=r,c[24]=n):n=c[24],c[25]!==n||c[26]!==t?(a=(0,i.jsxs)(i.Fragment,{children:[t,n]}),c[25]=n,c[26]=t,c[27]=a):a=c[27],a}return c[28]!==M?(l=(0,i.jsx)("primitive",{object:M,attach:"material"}),c[28]=M,c[29]=l):l=c[29],c[30]!==g||c[31]!==m||c[32]!==B||c[33]!==l?(s=(0,i.jsx)("mesh",{geometry:m,castShadow:g,receiveShadow:B,children:l}),c[30]=g,c[31]=m,c[32]=B,c[33]=l,c[34]=s):s=c[34],s}),tP=(0,o.memo)(function(e){let t,r,n,o,l,s,u,c,d=(0,a.c)(40),{material:f,shapeName:m,geometry:h,backGeometry:p,castShadow:A,receiveShadow:g}=e,B=void 0!==A&&A,C=void 0!==g&&g,y=f.userData.resource_path;d[0]!==f.userData.flag_names?(t=f.userData.flag_names??[],d[0]=f.userData.flag_names,d[1]=t):t=d[1],d[2]!==t?(r=new Set(t),d[2]=t,d[3]=r):r=d[3];let E=r;y||console.warn(`No resource_path was found on "${m}" - rendering fallback.`),d[4]!==y?(n=y?(0,v.textureToUrl)(y):v.FALLBACK_TEXTURE_URL,d[4]=y,d[5]=n):n=d[5];let M=n;d[6]!==m?(o=m&&tE(m),d[6]=m,d[7]=o):o=d[7];let S=o,F=E.has("Translucent");d[8]!==S||d[9]!==F?(l=e=>S||F?(0,b.setupTexture)(e,{disableMipmaps:!0}):(0,b.setupTexture)(e),d[8]=S,d[9]=F,d[10]=l):l=d[10];let T=(0,x.useTexture)(M,l);d[11]!==E||d[12]!==S||d[13]!==f||d[14]!==T?(s=tL(f,T,E,S),d[11]=E,d[12]=S,d[13]=f,d[14]=T,d[15]=s):s=d[15];let R=s;if(Array.isArray(R)){let e,t,r,n,a,o=p||h;return d[16]!==R[0]?(e=(0,i.jsx)("primitive",{object:R[0],attach:"material"}),d[16]=R[0],d[17]=e):e=d[17],d[18]!==B||d[19]!==C||d[20]!==e||d[21]!==o?(t=(0,i.jsx)("mesh",{geometry:o,castShadow:B,receiveShadow:C,children:e}),d[18]=B,d[19]=C,d[20]=e,d[21]=o,d[22]=t):t=d[22],d[23]!==R[1]?(r=(0,i.jsx)("primitive",{object:R[1],attach:"material"}),d[23]=R[1],d[24]=r):r=d[24],d[25]!==B||d[26]!==h||d[27]!==C||d[28]!==r?(n=(0,i.jsx)("mesh",{geometry:h,castShadow:B,receiveShadow:C,children:r}),d[25]=B,d[26]=h,d[27]=C,d[28]=r,d[29]=n):n=d[29],d[30]!==t||d[31]!==n?(a=(0,i.jsxs)(i.Fragment,{children:[t,n]}),d[30]=t,d[31]=n,d[32]=a):a=d[32],a}return d[33]!==R?(u=(0,i.jsx)("primitive",{object:R,attach:"material"}),d[33]=R,d[34]=u):u=d[34],d[35]!==B||d[36]!==h||d[37]!==C||d[38]!==u?(c=(0,i.jsx)("mesh",{geometry:h,castShadow:B,receiveShadow:C,children:u}),d[35]=B,d[36]=h,d[37]=C,d[38]=u,d[39]=c):c=d[39],c}),tO=(0,o.memo)(function(e){let t=(0,a.c)(14),{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:s,receiveShadow:u}=e,c=void 0!==s&&s,d=void 0!==u&&u,f=new Set(r.userData.flag_names??[]).has("IflMaterial"),m=r.userData.resource_path;if(f&&m){let e;return t[0]!==l||t[1]!==c||t[2]!==o||t[3]!==r||t[4]!==d||t[5]!==n?(e=(0,i.jsx)(t_,{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:c,receiveShadow:d}),t[0]=l,t[1]=c,t[2]=o,t[3]=r,t[4]=d,t[5]=n,t[6]=e):e=t[6],e}if(!r.name)return null;{let e;return t[7]!==l||t[8]!==c||t[9]!==o||t[10]!==r||t[11]!==d||t[12]!==n?(e=(0,i.jsx)(tP,{material:r,shapeName:n,geometry:o,backGeometry:l,castShadow:c,receiveShadow:d}),t[7]=l,t[8]=c,t[9]=o,t[10]=r,t[11]=d,t[12]=n,t[13]=e):e=t[13],e}});function tk(e){let t,r,n,o,l=(0,a.c)(9),{color:s,label:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(r=(0,i.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=r):r=l[2],l[3]!==s||l[4]!==u?(n=u?(0,i.jsx)(e9.FloatingLabel,{color:s,children:u}):null,l[3]=s,l[4]=u,l[5]=n):n=l[5],l[6]!==r||l[7]!==n?(o=(0,i.jsxs)("mesh",{children:[t,r,n]}),l[6]=r,l[7]=n,l[8]=o):o=l[8],o}function tH(e){let t,r=(0,a.c)(4),{color:n,label:o}=e,{debugMode:l}=(0,S.useDebug)();return r[0]!==n||r[1]!==l||r[2]!==o?(t=l?(0,i.jsx)(tk,{color:n,label:o}):null,r[0]=n,r[1]=l,r[2]=o,r[3]=t):t=r[3],t}function tj(e){let t,r,n,l,s,u=(0,a.c)(13),{loadingColor:c,children:d}=e,f=void 0===c?"yellow":c,{object:m,shapeName:h}=tS();if(!h){let e,t=`${m._id}: `;return u[0]!==t?(e=(0,i.jsx)(tH,{color:"orange",label:t}),u[0]=t,u[1]=e):e=u[1],e}let p=`${m._id}: ${h}`;return u[2]!==p?(t=(0,i.jsx)(tH,{color:"red",label:p}),u[2]=p,u[3]=t):t=u[3],u[4]!==f?(r=(0,i.jsx)(tk,{color:f}),u[4]=f,u[5]=r):r=u[5],u[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,i.jsx)(tU,{}),u[6]=n):n=u[6],u[7]!==d||u[8]!==r?(l=(0,i.jsxs)(o.Suspense,{fallback:r,children:[n,d]}),u[7]=d,u[8]=r,u[9]=l):l=u[9],u[10]!==t||u[11]!==l?(s=(0,i.jsx)(q,{fallback:t,children:l}),u[10]=t,u[11]=l,u[12]=s):s=u[12],s}let tU=(0,o.memo)(function(){var e;let t,r,n,l,s,u,c,d,f=(0,a.c)(19),{object:m,shapeName:h,isOrganic:p}=tS(),{debugMode:A}=(0,S.useDebug)(),{nodes:g}=((d=(0,a.c)(2))[0]!==h?(c=(0,v.shapeToUrl)(h),d[0]=h,d[1]=c):c=d[1],e2(c));if(f[0]!==g){e:{let r,n=Object.values(g).filter(tN);if(n.length>0){let r;e=n[0].skeleton,r=new Set,e.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),t=r;break e}f[2]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,f[2]=r):r=f[2],t=r}f[0]=g,f[1]=t}else t=f[1];let B=t;f[3]!==B||f[4]!==p||f[5]!==g?(r=Object.entries(g).filter(tJ).map(e=>{let[,t]=e,r=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e.01&&t.has(o)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e1){let t=0,r=0,n=0;for(let i of e)t+=a[3*i],r+=a[3*i+1],n+=a[3*i+2];let i=Math.sqrt(t*t+r*r+n*n);for(let o of(i>0&&(t/=i,r/=i,n/=i),e))a[3*o]=t,a[3*o+1]=r,a[3*o+2]=n}if(t.needsUpdate=!0,p){let e=(n=r.clone()).attributes.normal,t=e.array;for(let e=0;e{let{node:t,geometry:r,backGeometry:n}=e;return(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)("mesh",{geometry:r,children:(0,i.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:t.material?Array.isArray(t.material)?t.material.map((e,t)=>(0,i.jsx)(tO,{material:e,shapeName:h,geometry:r,backGeometry:n,castShadow:y,receiveShadow:y},t)):(0,i.jsx)(tO,{material:t.material,shapeName:h,geometry:r,backGeometry:n,castShadow:y,receiveShadow:y}):null},t.id)}),f[8]=y,f[9]=C,f[10]=h,f[11]=l):l=f[11],f[12]!==A||f[13]!==m||f[14]!==h?(s=A?(0,i.jsxs)(e9.FloatingLabel,{children:[m._id,": ",h]}):null,f[12]=A,f[13]=m,f[14]=h,f[15]=s):s=f[15],f[16]!==l||f[17]!==s?(u=(0,i.jsxs)("group",{rotation:n,children:[l,s]}),f[16]=l,f[17]=s,f[18]=u):u=f[18],u});function tN(e){return e.skeleton}function tJ(e){let[,t]=e;return t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)}var tK=e.i(6112);let tQ={1:"Storm",2:"Inferno"},tV=(0,o.createContext)(null);function tX(){let e=(0,o.useContext)(tV);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function tq({children:e}){let{camera:t}=(0,C.useThree)(),[r,n]=(0,o.useState)(-1),[a,l]=(0,o.useState)({}),[s,c]=(0,o.useState)(()=>({initialized:!1,position:null,quarternion:null})),d=(0,o.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),f=(0,o.useCallback)(e=>{l(t=>{let{[e.id]:r,...n}=t;return n})},[]),m=Object.keys(a).length,h=(0,o.useCallback)(e=>{if(e>=0&&e{h(m?(r+1)%m:-1)},[m,r,h]);(0,o.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)),i=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new u.Vector3(...n),quarternion:new u.Quaternion(...i)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,o.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,o.useEffect)(()=>{s.initialized&&!s.position&&m>0&&-1===r&&h(0)},[m,h,r,s]);let A=(0,o.useMemo)(()=>({registerCamera:d,unregisterCamera:f,nextCamera:p,setCameraIndex:h,cameraCount:m}),[d,f,p,h,m]);return 0===m&&-1!==r&&n(-1),(0,i.jsx)(tV.Provider,{value:A,children:e})}let tW=(0,o.createContext)(null),tY=tW.Provider,tz=(0,o.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),tZ={AudioEmitter:function(e){let t,r=(0,a.c)(3),{audioEnabled:n}=(0,S.useSettings)();return r[0]!==n||r[1]!==e?(t=n?(0,i.jsx)(tz,{...e}):null,r[0]=n,r[1]=e,r[2]=t):t=r[2],t},Camera:function(e){let t,r,n,i,l,s=(0,a.c)(14),{object:c}=e,{registerCamera:d,unregisterCamera:f}=tX(),m=(0,o.useId)();s[0]!==c?(t=(0,y.getProperty)(c,"dataBlock"),s[0]=c,s[1]=t):t=s[1];let h=t;s[2]!==c?(r=(0,y.getPosition)(c),s[2]=c,s[3]=r):r=s[3];let p=r;s[4]!==c?(n=(0,y.getRotation)(c),s[4]=c,s[5]=n):n=s[5];let A=n;return s[6]!==h||s[7]!==m||s[8]!==p||s[9]!==A||s[10]!==d||s[11]!==f?(i=()=>{if("Observer"===h){let e={id:m,position:new u.Vector3(...p),rotation:A};return d(e),()=>{f(e)}}},l=[m,h,d,f,p,A],s[6]=h,s[7]=m,s[8]=p,s[9]=A,s[10]=d,s[11]=f,s[12]=i,s[13]=l):(i=s[12],l=s[13]),(0,o.useEffect)(i,l),null},ForceFieldBare:(0,o.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:tr,Item:function(e){let t,r,n,o,l,s,u,c,d,f=(0,a.c)(23),{object:m}=e,h=J();f[0]!==m?(t=(0,y.getProperty)(m,"dataBlock")??"",f[0]=m,f[1]=t):t=f[1];let p=t,A=(0,tK.useDatablock)(p);f[2]!==m?(r=(0,y.getPosition)(m),f[2]=m,f[3]=r):r=f[3];let g=r;f[4]!==m?(n=(0,y.getScale)(m),f[4]=m,f[5]=n):n=f[5];let v=n;f[6]!==m?(o=(0,y.getRotation)(m),f[6]=m,f[7]=o):o=f[7];let B=o;f[8]!==A?(l=(0,y.getProperty)(A,"shapeFile"),f[8]=A,f[9]=l):l=f[9];let C=l;C||console.error(` missing shape for datablock: ${p}`);let b=p?.toLowerCase()==="flag",x=h?.team??null,E=x&&x>0?tQ[x]:null,M=b&&E?`${E} Flag`:null;return f[10]!==M?(s=M?(0,i.jsx)(e9.FloatingLabel,{opacity:.6,children:M}):null,f[10]=M,f[11]=s):s=f[11],f[12]!==s?(u=(0,i.jsx)(tj,{loadingColor:"pink",children:s}),f[12]=s,f[13]=u):u=f[13],f[14]!==g||f[15]!==B||f[16]!==v||f[17]!==u?(c=(0,i.jsx)("group",{position:g,quaternion:B,scale:v,children:u}),f[14]=g,f[15]=B,f[16]=v,f[17]=u,f[18]=c):c=f[18],f[19]!==m||f[20]!==C||f[21]!==c?(d=(0,i.jsx)(tF,{type:"Item",object:m,shapeName:C,children:c}),f[19]=m,f[20]=C,f[21]=c,f[22]=d):d=f[22],d},SimGroup:function(e){let t,r,n,o,l=(0,a.c)(17),{object:s}=e,u=J(),c=null,d=!1;if(u&&u.hasTeams){if(d=!0,null!=u.team)c=u.team;else if(s._name){let e;if(l[0]!==s._name){let t;l[2]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,l[2]=t):t=l[2],e=s._name.match(t),l[0]=s._name,l[1]=e}else e=l[1];let t=e;t&&(c=parseInt(t[1],10))}}else if(s._name){let e;l[3]!==s._name?(e=s._name.toLowerCase(),l[3]=s._name,l[4]=e):e=l[4],d="teams"===e}l[5]!==d||l[6]!==s||l[7]!==u||l[8]!==c?(t={object:s,parent:u,hasTeams:d,team:c},l[5]=d,l[6]=s,l[7]=u,l[8]=c,l[9]=t):t=l[9];let f=t;return l[10]!==s._children?(r=s._children??[],l[10]=s._children,l[11]=r):r=l[11],l[12]!==r?(n=r.map(K),l[12]=r,l[13]=n):n=l[13],l[14]!==f||l[15]!==n?(o=(0,i.jsx)(N.Provider,{value:f,children:n}),l[14]=f,l[15]=n,l[16]=o):o=l[16],o},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,S.useSettings)(),n=(0,y.getProperty)(e,"materialList"),a=(0,o.useMemo)(()=>th((0,y.getProperty)(e,"SkySolidColor")),[e]),l=(0,y.getInt)(e,"useSkyTextures")??1,s=(0,o.useMemo)(()=>(function(e,t=!0){let r=(0,y.getFloat)(e,"fogDistance")??0,n=(0,y.getFloat)(e,"visibleDistance")??1e3,i=(0,y.getFloat)(e,"high_fogDistance"),a=(0,y.getFloat)(e,"high_visibleDistance"),o=t&&null!=i&&i>0?i:r,l=t&&null!=a&&a>0?a:n,s=function(e){if(!e)return new u.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new u.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,y.getProperty)(e,"fogColor")),c=[];for(let t=1;t<=3;t++){let r=function(e,t=1){if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[n,i,a]=r;return n<=0||a<=i?null:{visibleDistance:n,minHeight:i,maxHeight:a,percentage:Math.max(0,Math.min(1,t))}}((0,y.getProperty)(e,`fogVolume${t}`),1);r&&c.push(r)}let d=c.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:o,visibleDistance:l,fogColor:s,fogVolumes:c,fogLine:d,enabled:l>o}})(e,r),[e,r]),c=(0,o.useMemo)(()=>th((0,y.getProperty)(e,"fogColor")),[e]),d=a||c,f=s.enabled&&t,m=s.fogColor,{scene:h,gl:p}=(0,C.useThree)();(0,o.useEffect)(()=>{if(f){let e=m.clone();h.background=e,p.setClearColor(e)}else if(d){let e=d[0].clone();h.background=e,p.setClearColor(e)}else h.background=null;return()=>{h.background=null}},[h,p,f,m,d]);let A=a?.[1];return(0,i.jsxs)(i.Fragment,{children:[n&&l?(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(tA,{materialList:n,fogColor:f?m:void 0,fogState:f?s:void 0},n)}):A?(0,i.jsx)(tg,{skyColor:A,fogColor:f?m:void 0,fogState:f?s:void 0}):null,(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(td,{object:e})}),s.enabled?(0,i.jsx)(tB,{fogState:s,enabled:t}):null]})},StaticShape:function(e){let t,r,n,o,l,s,u,c,d=(0,a.c)(19),{object:f}=e;d[0]!==f?(t=(0,y.getProperty)(f,"dataBlock")??"",d[0]=f,d[1]=t):t=d[1];let m=t,h=(0,tK.useDatablock)(m);d[2]!==f?(r=(0,y.getPosition)(f),d[2]=f,d[3]=r):r=d[3];let p=r;d[4]!==f?(n=(0,y.getRotation)(f),d[4]=f,d[5]=n):n=d[5];let A=n;d[6]!==f?(o=(0,y.getScale)(f),d[6]=f,d[7]=o):o=d[7];let g=o;d[8]!==h?(l=(0,y.getProperty)(h,"shapeFile"),d[8]=h,d[9]=l):l=d[9];let v=l;return v||console.error(` missing shape for datablock: ${m}`),d[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,i.jsx)(tj,{}),d[10]=s):s=d[10],d[11]!==p||d[12]!==A||d[13]!==g?(u=(0,i.jsx)("group",{position:p,quaternion:A,scale:g,children:s}),d[11]=p,d[12]=A,d[13]=g,d[14]=u):u=d[14],d[15]!==f||d[16]!==v||d[17]!==u?(c=(0,i.jsx)(tF,{type:"StaticShape",object:f,shapeName:v,children:u}),d[15]=f,d[16]=v,d[17]=u,d[18]=c):c=d[18],c},Sun:function(e){let t,r,n,l,s,c,d,f,m,h,p=(0,a.c)(25),{object:A}=e;p[0]!==A?(t=((0,y.getProperty)(A,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(tb),p[0]=A,p[1]=t):t=p[1];let[g,v,B]=t,C=Math.sqrt(g*g+B*B+v*v),b=g/C,x=B/C,M=v/C;p[2]!==b||p[3]!==x||p[4]!==M?(r=new u.Vector3(b,x,M),p[2]=b,p[3]=x,p[4]=M,p[5]=r):r=p[5];let S=r,F=-(5e3*S.x),T=-(5e3*S.y),R=-(5e3*S.z);p[6]!==F||p[7]!==T||p[8]!==R?(n=new u.Vector3(F,T,R),p[6]=F,p[7]=T,p[8]=R,p[9]=n):n=p[9];let w=n;if(p[10]!==A){let[e,t,r]=((0,y.getProperty)(A,"color")??"0.7 0.7 0.7 1").split(" ").map(ty);l=new u.Color(e,t,r),p[10]=A,p[11]=l}else l=p[11];let D=l;if(p[12]!==A){let[e,t,r]=((0,y.getProperty)(A,"ambient")??"0.5 0.5 0.5 1").split(" ").map(tC);s=new u.Color(e,t,r),p[12]=A,p[13]=s}else s=p[13];let I=s,G=S.y<0;return p[14]!==G?(c=()=>{E.value=G},d=[G],p[14]=G,p[15]=c,p[16]=d):(c=p[15],d=p[16]),(0,o.useEffect)(c,d),p[17]!==D||p[18]!==w?(f=(0,i.jsx)("directionalLight",{position:w,color:D,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}),p[17]=D,p[18]=w,p[19]=f):f=p[19],p[20]!==I?(m=(0,i.jsx)("ambientLight",{color:I,intensity:1}),p[20]=I,p[21]=m):m=p[21],p[22]!==f||p[23]!==m?(h=(0,i.jsxs)(i.Fragment,{children:[f,m]}),p[22]=f,p[23]=m,p[24]=h):h=p[24],h},TerrainBlock:P,TSStatic:function(e){let t,r,n,o,l,s,u,c=(0,a.c)(17),{object:d}=e;c[0]!==d?(t=(0,y.getProperty)(d,"shapeName"),c[0]=d,c[1]=t):t=c[1];let f=t;c[2]!==d?(r=(0,y.getPosition)(d),c[2]=d,c[3]=r):r=c[3];let m=r;c[4]!==d?(n=(0,y.getRotation)(d),c[4]=d,c[5]=n):n=c[5];let h=n;c[6]!==d?(o=(0,y.getScale)(d),c[6]=d,c[7]=o):o=c[7];let p=o;return f||console.error(" missing shapeName for object",d),c[8]===Symbol.for("react.memo_cache_sentinel")?(l=(0,i.jsx)(tj,{}),c[8]=l):l=c[8],c[9]!==m||c[10]!==h||c[11]!==p?(s=(0,i.jsx)("group",{position:m,quaternion:h,scale:p,children:l}),c[9]=m,c[10]=h,c[11]=p,c[12]=s):s=c[12],c[13]!==d||c[14]!==f||c[15]!==s?(u=(0,i.jsx)(tF,{type:"TSStatic",object:d,shapeName:f,children:s}),c[13]=d,c[14]=f,c[15]=s,c[16]=u):u=c[16],u},Turret:function(e){let t,r,n,o,l,s,u,c,d,f,m,h=(0,a.c)(27),{object:p}=e;h[0]!==p?(t=(0,y.getProperty)(p,"dataBlock")??"",h[0]=p,h[1]=t):t=h[1];let A=t;h[2]!==p?(r=(0,y.getProperty)(p,"initialBarrel"),h[2]=p,h[3]=r):r=h[3];let g=r,v=(0,tK.useDatablock)(A),B=(0,tK.useDatablock)(g);h[4]!==p?(n=(0,y.getPosition)(p),h[4]=p,h[5]=n):n=h[5];let C=n;h[6]!==p?(o=(0,y.getRotation)(p),h[6]=p,h[7]=o):o=h[7];let b=o;h[8]!==p?(l=(0,y.getScale)(p),h[8]=p,h[9]=l):l=h[9];let x=l;h[10]!==v?(s=(0,y.getProperty)(v,"shapeFile"),h[10]=v,h[11]=s):s=h[11];let E=s;h[12]!==B?(u=(0,y.getProperty)(B,"shapeFile"),h[12]=B,h[13]=u):u=h[13];let M=u;return E||console.error(` missing shape for datablock: ${A}`),g&&!M&&console.error(` missing shape for barrel datablock: ${g}`),h[14]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)(tj,{}),h[14]=c):c=h[14],h[15]!==M||h[16]!==p?(d=M?(0,i.jsx)(tF,{type:"Turret",object:p,shapeName:M,children:(0,i.jsx)("group",{position:[0,1.5,0],children:(0,i.jsx)(tj,{})})}):null,h[15]=M,h[16]=p,h[17]=d):d=h[17],h[18]!==C||h[19]!==b||h[20]!==x||h[21]!==d?(f=(0,i.jsxs)("group",{position:C,quaternion:b,scale:x,children:[c,d]}),h[18]=C,h[19]=b,h[20]=x,h[21]=d,h[22]=f):f=h[22],h[23]!==p||h[24]!==E||h[25]!==f?(m=(0,i.jsx)(tF,{type:"Turret",object:p,shapeName:E,children:f}),h[23]=p,h[24]=E,h[25]=f,h[26]=m):m=h[26],m},WaterBlock:(0,o.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,r,n,o=(0,a.c)(7),{object:l}=e;o[0]!==l?(t=(0,y.getPosition)(l),o[0]=l,o[1]=t):t=o[1];let s=t;o[2]!==l?(r=(0,y.getProperty)(l,"name"),o[2]=l,o[3]=r):r=o[3];let u=r;return o[4]!==u||o[5]!==s?(n=u?(0,i.jsx)(e9.FloatingLabel,{position:s,opacity:.6,children:u}):null,o[4]=u,o[5]=s,o[6]=n):n=o[6],n}};function t$(e){let t,r,n,l=(0,a.c)(9),{object:s}=e,{missionType:u}=(0,o.useContext)(tW);l[0]!==s?(t=new Set(((0,y.getProperty)(s,"missionTypesList")??"").toLowerCase().split(/s+/).filter(Boolean)),l[0]=s,l[1]=t):t=l[1];let c=t;l[2]!==u||l[3]!==c?(r=!c.size||c.has(u.toLowerCase()),l[2]=u,l[3]=c,l[4]=r):r=l[4];let d=r,f=tZ[s._className];return l[5]!==f||l[6]!==s||l[7]!==d?(n=d&&f?(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(f,{object:s})}):null,l[5]=f,l[6]=s,l[7]=d,l[8]=n):n=l[8],n}var t0=e.i(86608),t1=e.i(38433),t2=e.i(33870),t9=e.i(91996);let t3=async e=>{let t;try{t=(0,v.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let r=await fetch(t);if(!r.ok)return console.error(`Script fetch failed: ${e} (${r.status})`),null;return await r.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}},t5=(0,t2.createScriptCache)(),t8={findFiles:e=>{let t=(0,g.default)(e,{nocase:!0});return(0,t9.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,t9.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,t9.getResourceMap)()[(0,t9.getResourceKey)(e)]},t6=(0,o.memo)(function(e){let t,r,n,l,s,u,c,d,f=(0,a.c)(17),{name:m,missionType:h,onLoadingChange:p}=e,{data:g}=((d=(0,a.c)(2))[0]!==m?(c={queryKey:["parsedMission",m],queryFn:()=>(0,v.loadMission)(m)},d[0]=m,d[1]=c):c=d[1],(0,A.useQuery)(c)),{missionGroup:B,runtime:C,progress:y}=function(e,t,r){let n,i,l,s=(0,a.c)(6);s[0]===Symbol.for("react.memo_cache_sentinel")?(n={missionGroup:void 0,runtime:void 0,progress:0},s[0]=n):n=s[0];let[u,c]=(0,o.useState)(n);return s[1]!==e||s[2]!==t||s[3]!==r?(i=()=>{if(!r)return;let n=new AbortController,i=(0,t1.createProgressTracker)(),a=()=>{c(e=>({...e,progress:i.progress}))};i.on("update",a);let{runtime:o}=(0,t0.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:t3,fileSystem:t8,cache:t5,signal:n.signal,progress:i,ignoreScripts:["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]},onMissionLoadDone:()=>{c({missionGroup:l.getObjectByName("MissionGroup"),runtime:l,progress:1})}}),l=o;return()=>{i.off("update",a),n.abort(),l.destroy()}},l=[e,t,r],s[1]=e,s[2]=t,s[3]=r,s[4]=i,s[5]=l):(i=s[4],l=s[5]),(0,o.useEffect)(i,l),u}(m,h,g),b=!g||!B||!C;f[0]!==B||f[1]!==h||f[2]!==g?(t={metadata:g,missionType:h,missionGroup:B},f[0]=B,f[1]=h,f[2]=g,f[3]=t):t=f[3];let x=t;return(f[4]!==b||f[5]!==p||f[6]!==y?(r=()=>{p?.(b,y)},n=[b,y,p],f[4]=b,f[5]=p,f[6]=y,f[7]=r,f[8]=n):(r=f[7],n=f[8]),(0,o.useEffect)(r,n),b)?null:(f[9]!==B?(l=(0,i.jsx)(t$,{object:B}),f[9]=B,f[10]=l):l=f[10],f[11]!==C||f[12]!==l?(s=(0,i.jsx)(G.RuntimeProvider,{runtime:C,children:l}),f[11]=C,f[12]=l,f[13]=s):s=f[13],f[14]!==x||f[15]!==s?(u=(0,i.jsx)(tY,{value:x,children:s}),f[14]=x,f[15]=s,f[16]=u):u=f[16],u)});var t4=e.i(19273),t7=e.i(86491),re=e.i(40143),rt=e.i(15823),rr=class extends rt.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let n=t.queryKey,i=t.queryHash??(0,t4.hashQueryKeyByOptions)(n,t),a=this.get(i);return a||(a=new t7.Query({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,t4.matchQuery)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,t4.matchQuery)(e,t)):t}notify(e){re.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){re.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rn=e.i(88587),ri=e.i(36553),ra=class extends rn.Removable{#t;#r;#n;#i;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#r=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#r.includes(e)||(this.#r.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#r=this.#r.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#r.length||("pending"===this.state.status?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,ri.createRetryer)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let n="pending"===this.state.status,i=!this.#i.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:i})}let a=await this.#i.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#a({type:"success",data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#a({type:"error",error:t}),t}finally{this.#n.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),re.notifyManager.batch(()=>{this.#r.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}},ro=rt,rl=class extends ro.Subscribable{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#l=new Map,this.#s=0}#o;#l;#s;build(e,t,r){let n=new ra({client:e,mutationCache:this,mutationId:++this.#s,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=rs(e);if("string"==typeof t){let r=this.#l.get(t);r?r.push(e):this.#l.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=rs(e);if("string"==typeof t){let r=this.#l.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#l.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=rs(e);if("string"!=typeof t)return!0;{let r=this.#l.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=rs(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#l.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){re.notifyManager.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#l.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,t4.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,t4.matchMutation)(e,t))}notify(e){re.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return re.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(t4.noop))))}};function rs(e){return e.options.scope?.id}var ru=e.i(75555),rc=e.i(14448);function rd(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},s=0,u=async()=>{let r=!1,u=(0,t4.ensureQueryFn)(t.options,t.fetchOptions),c=async(e,n,i)=>{let a;if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let o=(a={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta},(0,t4.addConsumeAwareSignal)(a,()=>t.signal,()=>r=!0),a),l=await u(o),{maxPages:s}=t.options,c=i?t4.addToStart:t4.addToEnd;return{pages:c(e.pages,l,s),pageParams:c(e.pageParams,n,s)}};if(i&&a.length){let e="backward"===i,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:rf)(n,t);l=await c(t,r,e)}else{let t=e??a.length;do{let e=0===s?o[0]??n.initialPageParam:rf(n,l);if(s>0&&null==e)break;l=await c(l,e),s++}while(st.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function rf(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var rm=class{#u;#n;#c;#d;#f;#m;#h;#p;constructor(e={}){this.#u=e.queryCache||new rr,this.#n=e.mutationCache||new rl,this.#c=e.defaultOptions||{},this.#d=new Map,this.#f=new Map,this.#m=0}mount(){this.#m++,1===this.#m&&(this.#h=ru.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=rc.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#m--,0===this.#m&&(this.#h?.(),this.#h=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#n.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,t4.resolveStaleTime)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=this.#u.get(n.queryHash),a=i?.state.data,o=(0,t4.functionalUpdate)(t,a);if(void 0!==o)return this.#u.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return re.notifyManager.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;re.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return re.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(re.notifyManager.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(t4.noop).catch(t4.noop)}invalidateQueries(e,t={}){return re.notifyManager.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(re.notifyManager.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(t4.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(t4.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,t4.resolveStaleTime)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t4.noop).catch(t4.noop)}fetchInfiniteQuery(e){return e.behavior=rd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t4.noop).catch(t4.noop)}ensureInfiniteQueryData(e){return e.behavior=rd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return rc.onlineManager.isOnline()?this.#n.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#n}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,t4.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,t4.partialMatchKey)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#f.set((0,t4.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#f.values()],r={};return t.forEach(t=>{(0,t4.partialMatchKey)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,t4.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===t4.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#n.clear()}},rh=e.i(12598),rp=e.i(8155);let rA=e=>{let t=(0,rp.createStore)(e),r=e=>(function(e,t=e=>e){let r=o.default.useSyncExternalStore(e.subscribe,o.default.useCallback(()=>t(e.getState()),[e,t]),o.default.useCallback(()=>t(e.getInitialState()),[e,t]));return o.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},rg=o.createContext(null);function rv({map:e,children:t,onChange:r,domElement:n}){let i=e.map(e=>e.name+e.keys).join("-"),a=o.useMemo(()=>{let t,r;return t=()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(e,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());a=r=>{let n=e(r);if(!i(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return i(a)},t(e,r,n)})?rA(r):rA},[i]),l=o.useMemo(()=>[a.subscribe,a.getState,a],[i]),s=a.setState;return o.useEffect(()=>{let t=e.map(({name:e,keys:t,up:n})=>({keys:t,up:n,fn:t=>{s({[e]:t}),r&&r(e,t,l[1]())}})).reduce((e,{keys:t,fn:r,up:n=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:n}),e),{}),i=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,pressed:a,up:o}=n;n.pressed=!0,(o||!a)&&i(!0)},a=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,up:a}=n;n.pressed=!1,a&&i(!1)},o=n||window;return o.addEventListener("keydown",i,{passive:!0}),o.addEventListener("keyup",a,{passive:!0}),()=>{o.removeEventListener("keydown",i),o.removeEventListener("keyup",a)}},[n,i]),o.createElement(rg.Provider,{value:l,children:t})}function rB(e){let[t,r,n]=o.useContext(rg);return e?n(e):[t,r]}var rC=Object.defineProperty;class ry{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?rC(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,n=r.length;t{let n;return(n="symbol"!=typeof t?t+"":t)in e?rb(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let rE=new u.Euler(0,0,0,"YXZ"),rM=new u.Vector3,rS={type:"change"},rF={type:"lock"},rT={type:"unlock"},rR=Math.PI/2;class rw extends ry{constructor(e,t){super(),rx(this,"camera"),rx(this,"domElement"),rx(this,"isLocked"),rx(this,"minPolarAngle"),rx(this,"maxPolarAngle"),rx(this,"pointerSpeed"),rx(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(rE.setFromQuaternion(this.camera.quaternion),rE.y-=.002*e.movementX*this.pointerSpeed,rE.x-=.002*e.movementY*this.pointerSpeed,rE.x=Math.max(rR-this.maxPolarAngle,Math.min(rR-this.minPolarAngle,rE.x)),this.camera.quaternion.setFromEuler(rE),this.dispatchEvent(rS))}),rx(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(rF),this.isLocked=!0):(this.dispatchEvent(rT),this.isLocked=!1))}),rx(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),rx(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))}),rx(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))}),rx(this,"dispose",()=>{this.disconnect()}),rx(this,"getObject",()=>this.camera),rx(this,"direction",new u.Vector3(0,0,-1)),rx(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),rx(this,"moveForward",e=>{rM.setFromMatrixColumn(this.camera.matrix,0),rM.crossVectors(this.camera.up,rM),this.camera.position.addScaledVector(rM,e)}),rx(this,"moveRight",e=>{rM.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(rM,e)}),rx(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),rx(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)}}(n={}).forward="forward",n.backward="backward",n.left="left",n.right="right",n.up="up",n.down="down",n.lookUp="lookUp",n.lookDown="lookDown",n.lookLeft="lookLeft",n.lookRight="lookRight",n.camera1="camera1",n.camera2="camera2",n.camera3="camera3",n.camera4="camera4",n.camera5="camera5",n.camera6="camera6",n.camera7="camera7",n.camera8="camera8",n.camera9="camera9";let rD=Math.PI/2-.01;function rI(){let e,t,r,n,i,l,s,c,d,f,m,h,p,A=(0,a.c)(26),{speedMultiplier:g,setSpeedMultiplier:v}=(0,S.useControls)(),[y,b]=rB(),{camera:x,gl:E}=(0,C.useThree)(),{nextCamera:M,setCameraIndex:F,cameraCount:T}=tX(),R=(0,o.useRef)(null);A[0]===Symbol.for("react.memo_cache_sentinel")?(e=new u.Vector3,A[0]=e):e=A[0];let w=(0,o.useRef)(e);A[1]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Vector3,A[1]=t):t=A[1];let D=(0,o.useRef)(t);A[2]===Symbol.for("react.memo_cache_sentinel")?(r=new u.Vector3,A[2]=r):r=A[2];let I=(0,o.useRef)(r);A[3]===Symbol.for("react.memo_cache_sentinel")?(n=new u.Euler(0,0,0,"YXZ"),A[3]=n):n=A[3];let G=(0,o.useRef)(n);return A[4]!==x||A[5]!==E.domElement?(i=()=>{let e=new rw(x,E.domElement);return R.current=e,()=>{e.dispose()}},l=[x,E.domElement],A[4]=x,A[5]=E.domElement,A[6]=i,A[7]=l):(i=A[6],l=A[7]),(0,o.useEffect)(i,l),A[8]!==x||A[9]!==E.domElement||A[10]!==M?(s=()=>{let e=E.domElement,t=new u.Euler(0,0,0,"YXZ"),r=!1,n=!1,i=0,a=0,o=t=>{R.current?.isLocked||t.target===e&&(r=!0,n=!1,i=t.clientX,a=t.clientY)},l=e=>{!r||!n&&3>Math.abs(e.clientX-i)&&3>Math.abs(e.clientY-a)||(n=!0,t.setFromQuaternion(x.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-rD,Math.min(rD,t.x)),x.quaternion.setFromEuler(t))},s=()=>{r=!1},c=t=>{let r=R.current;!r||r.isLocked?M():t.target!==e||n||r.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),document.addEventListener("click",c),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s),document.removeEventListener("click",c)}},c=[x,E.domElement,M],A[8]=x,A[9]=E.domElement,A[10]=M,A[11]=s,A[12]=c):(s=A[11],c=A[12]),(0,o.useEffect)(s,c),A[13]!==T||A[14]!==F||A[15]!==y?(d=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return y(t=>{for(let r=0;r{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,r=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;v(e=>Math.max(.1,Math.min(5,Math.round((e+r)*20)/20)))},t=E.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},h=[E.domElement,v],A[18]=E.domElement,A[19]=v,A[20]=m,A[21]=h):(m=A[20],h=A[21]),(0,o.useEffect)(m,h),A[22]!==x||A[23]!==b||A[24]!==g?(p=(e,t)=>{let{forward:r,backward:n,left:i,right:a,up:o,down:l,lookUp:s,lookDown:u,lookLeft:c,lookRight:d}=b();if((s||u||c||d)&&(G.current.setFromQuaternion(x.quaternion,"YXZ"),c&&(G.current.y=G.current.y+ +t),d&&(G.current.y=G.current.y-t),s&&(G.current.x=G.current.x+ +t),u&&(G.current.x=G.current.x-t),G.current.x=Math.max(-rD,Math.min(rD,G.current.x)),x.quaternion.setFromEuler(G.current)),!r&&!n&&!i&&!a&&!o&&!l)return;let f=80*g;x.getWorldDirection(w.current),w.current.normalize(),D.current.crossVectors(x.up,w.current).normalize(),I.current.set(0,0,0),r&&I.current.add(w.current),n&&I.current.sub(w.current),i&&I.current.add(D.current),a&&I.current.sub(D.current),o&&(I.current.y=I.current.y+1),l&&(I.current.y=I.current.y-1),I.current.lengthSq()>0&&(I.current.normalize().multiplyScalar(f*t),x.position.add(I.current))},A[22]=x,A[23]=b,A[24]=g,A[25]=p):p=A[25],(0,B.useFrame)(p),null}let rG=[{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 rL(){let e,t,r=(0,a.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],r[0]=e):e=r[0],(0,o.useEffect)(r_,e),r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)(rI,{}),r[1]=t):t=r[1],t}function r_(){return window.addEventListener("keydown",rP,{capture:!0}),window.addEventListener("keyup",rP,{capture:!0}),()=>{window.removeEventListener("keydown",rP,{capture:!0}),window.removeEventListener("keyup",rP,{capture:!0})}}function rP(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}function rO(){let e,t,r,n,o,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y,b,x,E,M,S=(0,a.c)(51),F=rB(rX),T=rB(rV),R=rB(rQ),w=rB(rK),D=rB(rJ),I=rB(rN),G=rB(rU),L=rB(rj),_=rB(rH),P=rB(rk);return S[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[0]=e):e=S[0],S[1]!==F?(t=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":F,children:"W"}),S[1]=F,S[2]=t):t=S[2],S[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[3]=r):r=S[3],S[4]!==t?(n=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[e,t,r]}),S[4]=t,S[5]=n):n=S[5],S[6]!==R?(o=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":R,children:"A"}),S[6]=R,S[7]=o):o=S[7],S[8]!==T?(l=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":T,children:"S"}),S[8]=T,S[9]=l):l=S[9],S[10]!==w?(s=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":w,children:"D"}),S[10]=w,S[11]=s):s=S[11],S[12]!==o||S[13]!==l||S[14]!==s?(u=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[o,l,s]}),S[12]=o,S[13]=l,S[14]=s,S[15]=u):u=S[15],S[16]!==n||S[17]!==u?(c=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[n,u]}),S[16]=n,S[17]=u,S[18]=c):c=S[18],S[19]===Symbol.for("react.memo_cache_sentinel")?(d=(0,i.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↑"}),S[19]=d):d=S[19],S[20]!==D?(f=(0,i.jsx)("div",{className:"KeyboardOverlay-row",children:(0,i.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":D,children:[d," Space"]})}),S[20]=D,S[21]=f):f=S[21],S[22]===Symbol.for("react.memo_cache_sentinel")?(m=(0,i.jsx)("span",{className:"KeyboardOverlay-arrow",children:"↓"}),S[22]=m):m=S[22],S[23]!==I?(h=(0,i.jsx)("div",{className:"KeyboardOverlay-row",children:(0,i.jsxs)("div",{className:"KeyboardOverlay-key","data-pressed":I,children:[m," Shift"]})}),S[23]=I,S[24]=h):h=S[24],S[25]!==f||S[26]!==h?(p=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[f,h]}),S[25]=f,S[26]=h,S[27]=p):p=S[27],S[28]===Symbol.for("react.memo_cache_sentinel")?(A=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[28]=A):A=S[28],S[29]!==G?(g=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":G,children:"↑"}),S[29]=G,S[30]=g):g=S[30],S[31]===Symbol.for("react.memo_cache_sentinel")?(v=(0,i.jsx)("div",{className:"KeyboardOverlay-spacer"}),S[31]=v):v=S[31],S[32]!==g?(B=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[A,g,v]}),S[32]=g,S[33]=B):B=S[33],S[34]!==_?(C=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":_,children:"←"}),S[34]=_,S[35]=C):C=S[35],S[36]!==L?(y=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":L,children:"↓"}),S[36]=L,S[37]=y):y=S[37],S[38]!==P?(b=(0,i.jsx)("div",{className:"KeyboardOverlay-key","data-pressed":P,children:"→"}),S[38]=P,S[39]=b):b=S[39],S[40]!==C||S[41]!==y||S[42]!==b?(x=(0,i.jsxs)("div",{className:"KeyboardOverlay-row",children:[C,y,b]}),S[40]=C,S[41]=y,S[42]=b,S[43]=x):x=S[43],S[44]!==B||S[45]!==x?(E=(0,i.jsxs)("div",{className:"KeyboardOverlay-column",children:[B,x]}),S[44]=B,S[45]=x,S[46]=E):E=S[46],S[47]!==p||S[48]!==E||S[49]!==c?(M=(0,i.jsxs)("div",{className:"KeyboardOverlay",children:[c,p,E]}),S[47]=p,S[48]=E,S[49]=c,S[50]=M):M=S[50],M}function rk(e){return e.lookRight}function rH(e){return e.lookLeft}function rj(e){return e.lookDown}function rU(e){return e.lookUp}function rN(e){return e.down}function rJ(e){return e.up}function rK(e){return e.right}function rQ(e){return e.left}function rV(e){return e.backward}function rX(e){return e.forward}let rq=Math.PI/2-.01;function rW({joystickState:t,joystickZone:r,lookJoystickState:n,lookJoystickZone:a}){let{touchMode:l}=(0,S.useControls)();(0,o.useEffect)(()=>{let n=r.current;if(!n)return;let i=null,a=!1;return e.A(84968).then(e=>{a||((i=e.default.create({zone:n,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,r)=>{t.current.angle=r.angle.radian,t.current.force=Math.min(1,r.force)}),i.on("end",()=>{t.current.force=0}))}),()=>{a=!0,i?.destroy()}},[t,r,l]),(0,o.useEffect)(()=>{if("dualStick"!==l)return;let t=a.current;if(!t)return;let r=null,i=!1;return e.A(84968).then(e=>{i||((r=e.default.create({zone:t,mode:"static",position:{right:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,t)=>{n.current.angle=t.angle.radian,n.current.force=Math.min(1,t.force)}),r.on("end",()=>{n.current.force=0}))}),()=>{i=!0,r?.destroy()}},[l,n,a]);let s=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()};return"dualStick"===l?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{ref:r,className:"TouchJoystick TouchJoystick--left",onContextMenu:e=>e.preventDefault(),onTouchStart:s}),(0,i.jsx)("div",{ref:a,className:"TouchJoystick TouchJoystick--right",onContextMenu:e=>e.preventDefault(),onTouchStart:s})]}):(0,i.jsx)("div",{ref:r,className:"TouchJoystick",onContextMenu:e=>e.preventDefault(),onTouchStart:s})}function rY(e){let t,r,n,i,l,s,c,d,f,m,h=(0,a.c)(25),{joystickState:p,joystickZone:A,lookJoystickState:g}=e,{speedMultiplier:v,touchMode:y}=(0,S.useControls)(),{camera:b,gl:x}=(0,C.useThree)();h[0]===Symbol.for("react.memo_cache_sentinel")?(t=new u.Euler(0,0,0,"YXZ"),h[0]=t):t=h[0];let E=(0,o.useRef)(t),M=(0,o.useRef)(null);h[1]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},h[1]=r):r=h[1];let F=(0,o.useRef)(r);h[2]===Symbol.for("react.memo_cache_sentinel")?(n=new u.Vector3,h[2]=n):n=h[2];let T=(0,o.useRef)(n);h[3]===Symbol.for("react.memo_cache_sentinel")?(i=new u.Vector3,h[3]=i):i=h[3];let R=(0,o.useRef)(i);h[4]===Symbol.for("react.memo_cache_sentinel")?(l=new u.Vector3,h[4]=l):l=h[4];let w=(0,o.useRef)(l);return h[5]!==b.quaternion?(s=()=>{E.current.setFromQuaternion(b.quaternion,"YXZ")},h[5]=b.quaternion,h[6]=s):s=h[6],h[7]!==b?(c=[b],h[7]=b,h[8]=c):c=h[8],(0,o.useEffect)(s,c),h[9]!==b.quaternion||h[10]!==x.domElement||h[11]!==A||h[12]!==y?(d=()=>{if("moveLookStick"!==y)return;let e=x.domElement,t=e=>{let t=A.current;if(!t)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom},r=e=>{if(null===M.current)for(let r=0;r{if(null!==M.current)for(let t=0;t{for(let t=0;t{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",n),e.removeEventListener("touchend",i),e.removeEventListener("touchcancel",i),M.current=null}},h[9]=b.quaternion,h[10]=x.domElement,h[11]=A,h[12]=y,h[13]=d):d=h[13],h[14]!==b||h[15]!==x.domElement||h[16]!==A||h[17]!==y?(f=[b,x.domElement,A,y],h[14]=b,h[15]=x.domElement,h[16]=A,h[17]=y,h[18]=f):f=h[18],(0,o.useEffect)(d,f),h[19]!==b||h[20]!==p.current||h[21]!==g||h[22]!==v||h[23]!==y?(m=(e,t)=>{let{force:r,angle:n}=p.current;if("dualStick"===y){let e=g.current;if(e.force>.15){let r=(e.force-.15)/.85,n=Math.cos(e.angle),i=Math.sin(e.angle);E.current.setFromQuaternion(b.quaternion,"YXZ"),E.current.y=E.current.y-n*r*2.5*t,E.current.x=E.current.x+i*r*2.5*t,E.current.x=Math.max(-rq,Math.min(rq,E.current.x)),b.quaternion.setFromEuler(E.current)}if(r>.08){let e=80*v*((r-.08)/.92),i=Math.cos(n),a=Math.sin(n);b.getWorldDirection(T.current),T.current.normalize(),R.current.crossVectors(b.up,T.current).normalize(),w.current.set(0,0,0).addScaledVector(T.current,a).addScaledVector(R.current,-i),w.current.lengthSq()>0&&(w.current.normalize().multiplyScalar(e*t),b.position.add(w.current))}}else if("moveLookStick"===y&&r>0){let e=80*v*.5;if(b.getWorldDirection(T.current),T.current.normalize(),w.current.copy(T.current).multiplyScalar(e*t),b.position.add(w.current),r>=.15){let e=Math.cos(n),i=Math.sin(n),a=(r-.15)/.85;E.current.setFromQuaternion(b.quaternion,"YXZ"),E.current.y=E.current.y-e*a*1.25*t,E.current.x=E.current.x+i*a*1.25*t,E.current.x=Math.max(-rq,Math.min(rq,E.current.x)),b.quaternion.setFromEuler(E.current)}}},h[19]=b,h[20]=p.current,h[21]=g,h[22]=v,h[23]=y,h[24]=m):m=h[24],(0,B.useFrame)(m),null}var rz="undefined"!=typeof window&&!!(null==(r=window.document)?void 0:r.createElement);function rZ(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function r$(e){return e?"self"in e?e.self:rZ(e).defaultView||window:self}function r0(e,t=!1){let{activeElement:r}=rZ(e);if(!(null==r?void 0:r.nodeName))return null;if(r2(r)&&r.contentDocument)return r0(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=rZ(r).getElementById(e);if(t)return t}}return r}function r1(e,t){return e===t||e.contains(t)}function r2(e){return"IFRAME"===e.tagName}function r9(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==r3.indexOf(e.type)}var r3=["button","color","file","image","reset","submit"];function r5(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function r8(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function r6(e){return e.isContentEditable||r8(e)}function r4(e){let t=0,r=0;if(r8(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=rZ(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&r1(e,n.anchorNode)&&n.focusNode&&r1(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function r7(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function ne(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return ne(e.parentElement)||document.scrollingElement||document.body}function nt(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function nr(e,t){return t&&e.item(t)||null}var nn=Symbol("FOCUS_SILENTLY");function ni(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function na(){}function no(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nl(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function ns(e){return e}function nu(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function nc(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function nd(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function nf(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function nm(...e){for(let t of e)if(void 0!==t)return t}function nh(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function np(){return rz&&!!navigator.maxTouchPoints}function nA(){return!!rz&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function ng(){return rz&&nA()&&/apple/i.test(navigator.vendor)}function nv(e){return!!(e.currentTarget&&!r1(e.currentTarget,e.target))}function nB(e){return e.target===e.currentTarget}function nC(e,t){let r=new FocusEvent("blur",t),n=e.dispatchEvent(r),i={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",i)),n}function ny(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function nb(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!r1(r,n)}function nx(e,t,r,n){let i=(e=>{if(n){let t=setTimeout(e,n);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function nE(e,t,r,n=window){let i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(nE(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var nM={...o},nS=nM.useId;nM.useDeferredValue;var nF=nM.useInsertionEffect,nT=rz?o.useLayoutEffect:o.useEffect;function nR(e){let t=(0,o.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return nF?nF(()=>{t.current=e}):t.current=e,(0,o.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function nw(...e){return(0,o.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)nh(r,t)}},e)}function nD(e){if(nS){let t=nS();return e||t}let[t,r]=(0,o.useState)(e);return nT(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function nI(e,t){let r=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,o.useEffect)(()=>()=>{r.current=!1},[])}function nG(){return(0,o.useReducer)(()=>[],[])}function nL(e){return nR("function"==typeof e?e:()=>e)}function n_(e,t,r=[]){let n=(0,o.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function nP(e=!1,t){let[r,n]=(0,o.useState)(null);return{portalRef:nw(n,t),portalNode:r,domReady:!e||r}}var nO=!1,nk=!1,nH=0,nj=0;function nU(e){let t,r;t=e.movementX||e.screenX-nH,r=e.movementY||e.screenY-nj,nH=e.screenX,nj=e.screenY,(t||r||0)&&(nk=!0)}function nN(){nk=!1}function nJ(e){let t=o.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function nK(e,t){return o.memo(e,t)}function nQ(e,t){let r,{wrapElement:n,render:a,...l}=t,s=nw(t.ref,a&&(0,o.isValidElement)(a)&&("ref"in a.props||"ref"in a)?({...a.props}).ref||a.ref:null);if(o.isValidElement(a)){let e={...a.props,ref:s};r=o.cloneElement(a,function(e,t){let r={...e};for(let n in t){if(!no(t,n))continue;if("className"===n){let n="className";r[n]=e[n]?`${e[n]} ${t[n]}`:t[n];continue}if("style"===n){let n="style";r[n]=e[n]?{...e[n],...t[n]}:t[n];continue}let i=t[n];if("function"==typeof i&&n.startsWith("on")){let t=e[n];if("function"==typeof t){r[n]=(...e)=>{i(...e),t(...e)};continue}}r[n]=i}return r}(l,e))}else r=a?a(l):(0,i.jsx)(e,{...l});return n?n(r):r}function nV(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function nX(e=[],t=[]){let r=o.createContext(void 0),n=o.createContext(void 0),a=()=>o.useContext(r),l=t=>e.reduceRight((e,r)=>(0,i.jsx)(r,{...t,children:e}),(0,i.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:a,useScopedContext:(e=!1)=>{let t=o.useContext(n),r=a();return e?t:t||r},useProviderContext:()=>{let e=o.useContext(n),t=a();if(!e||e!==t)return t},ContextProvider:l,ScopedContextProvider:e=>(0,i.jsx)(l,{...e,children:t.reduceRight((t,r)=>(0,i.jsx)(r,{...e,children:t}),(0,i.jsx)(n.Provider,{...e}))})}}var nq=nX(),nW=nq.useContext;nq.useScopedContext,nq.useProviderContext;var nY=nX([nq.ContextProvider],[nq.ScopedContextProvider]),nz=nY.useContext;nY.useScopedContext;var nZ=nY.useProviderContext,n$=nY.ContextProvider,n0=nY.ScopedContextProvider,n1=(0,o.createContext)(void 0),n2=(0,o.createContext)(void 0),n9=(0,o.createContext)(!0),n3="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function n5(e){return!(!e.matches(n3)||!r5(e)||e.closest("[inert]"))}function n8(e){if(!n5(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=r0(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function n6(e,t){let r=Array.from(e.querySelectorAll(n3));t&&r.unshift(e);let n=r.filter(n5);return n.forEach((e,t)=>{if(r2(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...n6(r))}}),n}function n4(e,t,r){let n=Array.from(e.querySelectorAll(n3)),i=n.filter(n8);return(t&&n8(e)&&i.unshift(e),i.forEach((e,t)=>{if(r2(e)&&e.contentDocument){let n=n4(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function n7(e,t){var r;let n,i,a,o;return r=document.body,n=r0(r),a=(i=n6(r,!1)).indexOf(n),(o=i.slice(a+1)).find(n8)||(e?i.find(n8):null)||(t?o[0]:null)||null}function ie(e,t){var r;let n,i,a,o;return r=document.body,n=r0(r),a=(i=n6(r,!1).reverse()).indexOf(n),(o=i.slice(a+1)).find(n8)||(e?i.find(n8):null)||(t?o[0]:null)||null}function it(e){let t=r0(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function ir(e){let t=r0(e);if(!t)return!1;if(r1(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function ii(e){!ir(e)&&n5(e)&&e.focus()}var ia=ng(),io=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],il=Symbol("safariFocusAncestor");function is(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function iu(e,t){return nR(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var ic=!1,id=!0;function im(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(id=!1)}function ih(e){e.metaKey||e.ctrlKey||e.altKey||(id=!0)}var ip=nV(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var a,l,s,u,c;let d=(0,o.useRef)(null);(0,o.useEffect)(()=>{!e||ic||(nE("mousedown",im,!0),nE("keydown",ih,!0),ic=!0)},[e]),ia&&(0,o.useEffect)(()=>{if(!e)return;let t=d.current;if(!t||!is(t))return;let r="labels"in t?t.labels:null;if(!r)return;let n=()=>queueMicrotask(()=>t.focus());for(let e of r)e.addEventListener("mouseup",n);return()=>{for(let e of r)e.removeEventListener("mouseup",n)}},[e]);let f=e&&nd(i),m=!!f&&!t,[h,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{e&&m&&h&&p(!1)},[e,m,h]),(0,o.useEffect)(()=>{if(!e||!h)return;let t=d.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{n5(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,h]);let A=iu(i.onKeyPressCapture,f),g=iu(i.onMouseDownCapture,f),v=iu(i.onClickCapture,f),B=i.onMouseDown,C=nR(t=>{if(null==B||B(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!ia||nv(t)||!r9(r)&&!is(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let a=function(e){for(;e&&!n5(e);)e=e.closest(n3);return e||null}(r.parentElement);a&&(a[il]=!0),nx(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),a&&(a[il]=!1),n||ii(r)})}),y=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&it(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",p(!0)))},b=i.onKeyDownCapture,x=nR(t=>{if(null==b||b(t),t.defaultPrevented||!e||h||t.metaKey||t.altKey||t.ctrlKey||!nB(t))return;let r=t.currentTarget;nx(r,"focusout",()=>y(t,r))}),E=i.onFocusCapture,M=nR(t=>{if(null==E||E(t),t.defaultPrevented||!e)return;if(!nB(t))return void p(!1);let r=t.currentTarget;id||function(e){let{tagName:t,readOnly:r,type:n}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:io.includes(n))}(t.target)?nx(t.target,"focusout",()=>y(t,r)):p(!1)}),S=i.onBlur,F=nR(t=>{null==S||S(t),!e||nb(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),T=(0,o.useContext)(n9),R=nR(t=>{e&&r&&t&&T&&queueMicrotask(()=>{it(t)||n5(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,o.useState)(()=>r(void 0));return nT(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,void 0]),n}(d),D=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),I=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),G=i.style,L=(0,o.useMemo)(()=>m?{pointerEvents:"none",...G}:G,[m,G]);return i={"data-focus-visible":e&&h||void 0,"data-autofocus":r||void 0,"aria-disabled":f||void 0,...i,ref:nw(d,R,i.ref),style:L,tabIndex:(a=e,l=m,s=D,u=I,c=i.tabIndex,a?l?s&&!u?-1:void 0:s?c:c||0:c),disabled:!!I&&!!m||void 0,contentEditable:f?void 0:i.contentEditable,onKeyPressCapture:A,onClickCapture:v,onMouseDownCapture:g,onMouseDown:C,onKeyDownCapture:x,onFocusCapture:M,onBlur:F},nf(i)});function iA(e){let t=[];for(let r of e)t.push(...r);return t}function ig(e){return e.slice().reverse()}function iv(e,t,r){return nR(n=>{var i;let a,o;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!nB(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(a=n.target)||r8(a))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let l=e.getState(),s=null==(i=nr(e,l.activeId))?void 0:i.element;if(!s)return;let{view:u,...c}=n;s!==(null==r?void 0:r.current)&&s.focus(),o=new KeyboardEvent(n.type,c),s.dispatchEvent(o)||n.preventDefault(),n.currentTarget.contains(s)&&n.stopPropagation()})}nJ(function(e){return nQ("div",ip(e))});var iB=nV(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...a}){let l=nZ();nu(e=e||l,!1);let s=(0,o.useRef)(null),u=(0,o.useRef)(null),c=function(e){let[t,r]=(0,o.useState)(!1),n=(0,o.useCallback)(()=>r(!0),[]),i=e.useState(t=>nr(e,t.activeId));return(0,o.useEffect)(()=>{let e=null==i?void 0:i.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(e),d=e.useState("moves"),[,f]=function(e){let[t,r]=(0,o.useState)(null);return nT(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(t?e.setBaseElement:null);(0,o.useEffect)(()=>{var n;if(!e||!d||!t||!r)return;let{activeId:i}=e.getState(),a=null==(n=nr(e,i))?void 0:n.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[e,d,t,r]),nT(()=>{if(!e||!d||!t)return;let{baseElement:r,activeId:n}=e.getState();if(null!==n||!r)return;let i=u.current;u.current=null,i&&nC(i,{relatedTarget:r}),it(r)||r.focus()},[e,d,t]);let m=e.useState("activeId"),h=e.useState("virtualFocus");nT(()=>{var r;if(!e||!t||!h)return;let n=u.current;if(u.current=null,!n)return;let i=(null==(r=nr(e,m))?void 0:r.element)||r0(n);i!==n&&nC(n,{relatedTarget:i})},[e,m,h,t]);let p=iv(e,a.onKeyDownCapture,u),A=iv(e,a.onKeyUpCapture,u),g=a.onFocusCapture,v=nR(t=>{var r;let n;if(null==g||g(t),t.defaultPrevented||!e)return;let{virtualFocus:i}=e.getState();if(!i)return;let a=t.relatedTarget,o=(n=(r=t.currentTarget)[nn],delete r[nn],n);nB(t)&&o&&(t.stopPropagation(),u.current=a)}),B=a.onFocus,C=nR(r=>{if(null==B||B(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?nB(r)&&!ni(e,n)&&queueMicrotask(c):nB(r)&&e.setActiveId(null)}),y=a.onBlurCapture,b=nR(t=>{var r;if(null==y||y(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:i}=e.getState();if(!n)return;let a=null==(r=nr(e,i))?void 0:r.element,o=t.relatedTarget,l=ni(e,o),s=u.current;u.current=null,nB(t)&&l?(o===a?s&&s!==o&&nC(s,t):a?nC(a,t):s&&nC(s,t),t.stopPropagation()):!ni(e,t.target)&&a&&nC(a,t)}),x=a.onKeyDown,E=nL(n),M=nR(t=>{var r;if(null==x||x(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!nB(t))return;let{orientation:n,renderedItems:i,activeId:a}=e.getState(),o=nr(e,a);if(null==(r=null==o?void 0:o.element)?void 0:r.isConnected)return;let l="horizontal"!==n,s="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&r8(t.currentTarget))return;let c={ArrowUp:(u||l)&&(()=>{if(u){let e=iA(ig(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(i))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==e?void 0:e.last()}),ArrowRight:(u||s)&&e.first,ArrowDown:(u||l)&&e.first,ArrowLeft:(u||s)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];if(c){let r=c();if(void 0!==r){if(!E(t))return;t.preventDefault(),e.move(r)}}});return a=n_(a,t=>(0,i.jsx)(n$,{value:e,children:t}),[e]),a={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=nr(e,r.activeId))?void 0:n.id}),...a,ref:nw(s,f,a.ref),onKeyDownCapture:p,onKeyUpCapture:A,onFocusCapture:v,onFocus:C,onBlurCapture:b,onKeyDown:M},a=ip({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...a})});nJ(function(e){return nQ("div",iB(e))});var iC=nX();iC.useContext,iC.useScopedContext;var iy=iC.useProviderContext,ib=nX([iC.ContextProvider],[iC.ScopedContextProvider]);ib.useContext,ib.useScopedContext;var ix=ib.useProviderContext,iE=ib.ContextProvider,iM=ib.ScopedContextProvider,iS=(0,o.createContext)(void 0),iF=(0,o.createContext)(void 0),iT=nX([iE],[iM]);iT.useContext,iT.useScopedContext;var iR=iT.useProviderContext,iw=iT.ContextProvider,iD=iT.ScopedContextProvider,iI=nV(function({store:e,...t}){let r=iR();return e=e||r,t={...t,ref:nw(null==e?void 0:e.setAnchorElement,t.ref)}});nJ(function(e){return nQ("div",iI(e))});var iG=(0,o.createContext)(void 0),iL=nX([iw,n$],[iD,n0]),i_=iL.useContext,iP=iL.useScopedContext,iO=iL.useProviderContext,ik=iL.ContextProvider,iH=iL.ScopedContextProvider,ij=(0,o.createContext)(void 0),iU=(0,o.createContext)(!1);function iN(e,t){let r=e.__unstableInternals;return nu(r,"Invalid store"),r[t]}function iJ(e,...t){let r=e,n=r,i=Symbol(),a=na,o=new Set,l=new Set,s=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,m=(e,t,r=u)=>(r.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),r.delete(t)}),h=(e,a,o=!1)=>{var s,m;if(!no(r,e))return;let h=(m=r[e],"function"==typeof a?a("function"==typeof m?m():m):a);if(h===r[e])return;if(!o)for(let r of t)null==(s=null==r?void 0:r.setState)||s.call(r,e,h);let p=r;r={...r,[e]:h};let A=Symbol();i=A,l.add(e);let g=(t,n,i)=>{var a;let o=f.get(t);(!o||o.some(t=>i?i.has(t):t===e))&&(null==(a=d.get(t))||a(),d.set(t,t(r,n)))};for(let e of u)g(e,p);queueMicrotask(()=>{if(i!==A)return;let e=r;for(let e of c)g(e,n,l);n=e,l.clear()})},p={getState:()=>r,setState:h,__unstableInternals:{setup:e=>(s.add(e),()=>s.delete(e)),init:()=>{let e=o.size,n=Symbol();o.add(n);let i=()=>{o.delete(n),o.size||a()};if(e)return i;let l=Object.keys(r).map(e=>nl(...t.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&no(n,e))return iX(t,[e],t=>{h(e,t[e],!0)})}))),u=[];for(let e of s)u.push(e());return a=nl(...l,...u,...t.map(iQ)),i},subscribe:(e,t)=>m(e,t),sync:(e,t)=>(d.set(t,t(r,r)),m(e,t)),batch:(e,t)=>(d.set(t,t(r,n)),m(e,t,c)),pick:e=>iJ(function(e,t){let r={};for(let n of t)no(e,n)&&(r[n]=e[n]);return r}(r,e),p),omit:e=>iJ(function(e,t){let r={...e};for(let e of t)no(r,e)&&delete r[e];return r}(r,e),p)}};return p}function iK(e,...t){if(e)return iN(e,"setup")(...t)}function iQ(e,...t){if(e)return iN(e,"init")(...t)}function iV(e,...t){if(e)return iN(e,"subscribe")(...t)}function iX(e,...t){if(e)return iN(e,"sync")(...t)}function iq(e,...t){if(e)return iN(e,"batch")(...t)}function iW(e,...t){if(e)return iN(e,"omit")(...t)}function iY(...e){var t;let r={};for(let n of e){let e=null==(t=null==n?void 0:n.getState)?void 0:t.call(n);e&&Object.assign(r,e)}let n=iJ(r,...e);return Object.assign({},...e,n)}function iz(e,t){}function iZ(e,t,r){if(!r)return!1;let n=e.find(e=>!e.disabled&&e.value);return(null==n?void 0:n.value)===t}function i$(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var i0=nV(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:n,setValueOnChange:i,showMinLength:a=0,showOnChange:l,showOnMouseDown:s,showOnClick:u=s,showOnKeyDown:c,showOnKeyPress:d=c,blurActiveItemOnClick:f,setValueOnClick:m=!0,moveOnKeyPress:h=!0,autoComplete:p="list",...A}){var g;let v,B=iO();nu(e=e||B,!1);let C=(0,o.useRef)(null),[y,b]=nG(),x=(0,o.useRef)(!1),E=(0,o.useRef)(!1),M=e.useState(e=>e.virtualFocus&&r),S="inline"===p||"both"===p,[F,T]=(0,o.useState)(S);g=[S],v=(0,o.useRef)(!1),nT(()=>{if(v.current)return(()=>{S&&T(!0)})();v.current=!0},g),nT(()=>()=>{v.current=!1},[]);let R=e.useState("value"),w=(0,o.useRef)();(0,o.useEffect)(()=>iX(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let D=e.useState(e=>{var t;if(S&&F){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=e.useState("renderedItems"),G=e.useState("open"),L=e.useState("contentElement"),_=(0,o.useMemo)(()=>{if(!S||!F)return R;if(iZ(I,D,M)){if(i$(R,D)){let e=(null==D?void 0:D.slice(R.length))||"";return R+e}return R}return D||R},[S,F,I,D,M,R]);(0,o.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>T(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,o.useEffect)(()=>{if(!S||!F||!D||!iZ(I,D,M)||!i$(R,D))return;let e=na;return queueMicrotask(()=>{let t=C.current;if(!t)return;let{start:r,end:n}=r4(t),i=R.length,a=D.length;nt(t,i,a),e=()=>{if(!it(t))return;let{start:e,end:o}=r4(t);e!==i||o===a&&nt(t,r,n)}}),()=>e()},[y,S,F,D,I,M,R]);let P=(0,o.useRef)(null),O=nR(n),k=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!G||!L)return;let t=ne(L);if(!t)return;P.current=t;let r=()=>{x.current=!1},n=()=>{if(!e||!x.current)return;let{activeId:t}=e.getState();null===t||t!==k.current&&(x.current=!1)},i={passive:!0,capture:!0};return t.addEventListener("wheel",r,i),t.addEventListener("touchmove",r,i),t.addEventListener("scroll",n,i),()=>{t.removeEventListener("wheel",r,!0),t.removeEventListener("touchmove",r,!0),t.removeEventListener("scroll",n,!0)}},[G,L,e]),nT(()=>{!R||E.current||(x.current=!0)},[R]),nT(()=>{"always"!==M&&G||(x.current=G)},[M,G]);let H=e.useState("resetValueOnSelect");nI(()=>{var t,r;let n=x.current;if(!e||!G||!n&&!H)return;let{baseElement:i,contentElement:a,activeId:o}=e.getState();if(!i||it(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(b);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(M&&n){let r,n=O(I),i=void 0!==n?n:null!=(t=null==(r=I.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();k.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,G,y,R,M,H,O,I]),(0,o.useEffect)(()=>{if(!S)return;let t=C.current;if(!t)return;let r=[t,L].filter(e=>!!e),n=t=>{r.every(e=>nb(t,e))&&(null==e||e.setValue(_))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[S,L,e,_]);let j=e=>e.currentTarget.value.length>=a,U=A.onChange,N=nL(null!=l?l:j),J=nL(null!=i?i:!e.tag),K=nR(t=>{if(null==U||U(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,o=t.nativeEvent;if(x.current=!0,"input"===o.type&&(o.isComposing&&(x.current=!1,E.current=!0),S)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;T(e&&t)}if(J(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{nt(r,i,a)}),S&&M&&t&&b()}N(t)&&e.show(),M&&x.current||e.setActiveId(null)}),Q=A.onCompositionEnd,V=nR(e=>{x.current=!0,E.current=!1,null==Q||Q(e),e.defaultPrevented||M&&b()}),X=A.onMouseDown,q=nL(null!=f?f:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=nL(m),Y=nL(null!=u?u:j),z=nR(t=>{null==X||X(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(q(t)&&e.setActiveId(null),W(t)&&e.setValue(_),Y(t)&&nx(t.currentTarget,"mouseup",e.show))}),Z=A.onKeyDown,$=nL(null!=d?d:j),ee=nR(t=>{if(null==Z||Z(t),t.repeat||(x.current=!1),t.defaultPrevented||t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||!e)return;let{open:r}=e.getState();!r&&("ArrowUp"===t.key||"ArrowDown"===t.key)&&$(t)&&(t.preventDefault(),e.show())}),et=A.onBlur,er=nR(e=>{if(x.current=!1,null==et||et(e),e.defaultPrevented)return}),en=nD(A.id),ei=e.useState(e=>null===e.activeId);return A={id:en,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":r7(L,"listbox"),"aria-expanded":G,"aria-controls":null==L?void 0:L.id,"data-active-item":ei||void 0,value:_,...A,ref:nw(C,A.ref),onChange:K,onCompositionEnd:V,onMouseDown:z,onKeyDown:ee,onBlur:er},A=iB({store:e,focusable:t,...A,moveOnKeyPress:e=>!nc(h,e)&&(S&&T(!0),!0)}),{autoComplete:"off",...A=iI({store:e,...A})}}),i1=nJ(function(e){return nQ("input",i0(e))});function i2(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var i9=Symbol("composite-hover"),i3=nV(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=nz();nu(e=e||i,!1);let a=((0,o.useEffect)(()=>{nO||(nE("mousemove",nU,!0),nE("mousedown",nN,!0),nE("mouseup",nN,!0),nE("keydown",nN,!0),nE("scroll",nN,!0),nO=!0)},[]),nR(()=>nk)),l=n.onMouseMove,s=nL(t),u=nR(t=>{if((null==l||l(t),!t.defaultPrevented&&a())&&s(t)){if(!ir(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!it(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),c=n.onMouseLeave,d=nL(r),f=nR(t=>{var r;let n;null==c||c(t),!t.defaultPrevented&&a()&&((n=i2(t))&&r1(t.currentTarget,n)||function(e){let t=i2(e);if(!t)return!1;do{if(no(t,i9)&&t[i9])return!0;t=t.parentElement}while(t)return!1}(t)||!s(t)||d(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),m=(0,o.useCallback)(e=>{e&&(e[i9]=!0)},[]);return nf(n={...n,ref:nw(m,n.ref),onMouseMove:u,onMouseLeave:f})});nK(nJ(function(e){return nQ("div",i3(e))}));var i5=nV(function({store:e,shouldRegisterItem:t=!0,getItem:r=ns,element:n,...i}){let a=nW();e=e||a;let l=nD(i.id),s=(0,o.useRef)(n);return(0,o.useEffect)(()=>{let n=s.current;if(!l||!n||!t)return;let i=r({id:l,element:n});return null==e?void 0:e.renderItem(i)},[l,t,r,e]),nf(i={...i,ref:nw(s,i.ref)})});function i8(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?r9(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(r9(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}nJ(function(e){return nQ("div",i5(e))});var i6=Symbol("command"),i4=nV(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let n,i,a=(0,o.useRef)(null),[l,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{a.current&&s(r9(a.current))},[]);let[u,c]=(0,o.useState)(!1),d=(0,o.useRef)(!1),f=nd(r),[m,h]=(n=r.onLoadedMetadataCapture,i=(0,o.useMemo)(()=>Object.assign(()=>{},{...n,[i6]:!0}),[n,i6,!0]),[null==n?void 0:n[i6],{onLoadedMetadataCapture:i}]),p=r.onKeyDown,A=nR(r=>{null==p||p(r);let n=r.currentTarget;if(r.defaultPrevented||m||f||!nB(r)||r8(n)||n.isContentEditable)return;let i=e&&"Enter"===r.key,a=t&&" "===r.key,o="Enter"===r.key&&!e,l=" "===r.key&&!t;if(o||l)return void r.preventDefault();if(i||a){let e=i8(r);if(i){if(!e){r.preventDefault();let{view:e,...t}=r,i=()=>ny(n,t);rz&&/firefox\//i.test(navigator.userAgent)?nx(n,"keyup",i):queueMicrotask(i)}}else a&&(d.current=!0,e||(r.preventDefault(),c(!0)))}}),g=r.onKeyUp,v=nR(e=>{if(null==g||g(e),e.defaultPrevented||m||f||e.metaKey)return;let r=t&&" "===e.key;if(d.current&&r&&(d.current=!1,!i8(e))){e.preventDefault(),c(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>ny(t,n))}});return ip(r={"data-active":u||void 0,type:l?"button":void 0,...h,...r,ref:nw(a,r.ref),onKeyDown:A,onKeyUp:v})});nJ(function(e){return nQ("button",i4(e))});var{useSyncExternalStore:i7}=e.i(2239).default,ae=()=>()=>{};function at(e,t=ns){let r=o.useCallback(t=>e?iV(e,null,t):ae(),[e]),n=()=>{let r="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&r&&no(i,r)?i[r]:void 0};return i7(r,n,n)}function ar(e,t){let r=o.useRef({}),n=o.useCallback(t=>e?iV(e,null,t):ae(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!no(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return i7(n,i,i)}function an(e,t,r,n){var i;let a,l=no(t,r)?t[r]:void 0,s=(i={value:l,setValue:n?t[n]:void 0},a=(0,o.useRef)(i),nT(()=>{a.current=i}),a);nT(()=>iX(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),nT(()=>{if(void 0!==l)return e.setState(r,l),iq(e,[r],()=>{void 0!==l&&e.setState(r,l)})})}function ai(e,t){let[r,n]=o.useState(()=>e(t));nT(()=>iQ(r),[r]);let i=o.useCallback(e=>at(r,e),[r]);return[o.useMemo(()=>({...r,useState:i}),[r,i]),nR(()=>{n(r=>e({...t,...r.getState()}))})]}function aa(e,t,r,n=!1){var i;let a,o;if(!t||!r)return;let{renderedItems:l}=t.getState(),s=ne(e);if(!s)return;let u=function(e,t=!1){let r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(s,n);for(let e=0;e=0){void 0!==o&&ot||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===f,ariaSetSize:e=>null!=s?s:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e||!(null==h?void 0:h.ariaPosInSet)||h.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===A);return h.ariaPosInSet+t.findIndex(e=>e.id===f)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(a)return!0;if(null===t.activeId)return!1;let r=null==e?void 0:e.item(t.activeId);return null!=r&&!!r.disabled||null==r||!r.element||t.activeId===f}}),b=(0,o.useCallback)(e=>{var t;let r={...e,id:f||e.id,rowId:A,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return l?l(r):r},[f,A,p,l]),x=c.onFocus,E=(0,o.useRef)(!1),M=nR(t=>{var r,n;if(null==x||x(t),t.defaultPrevented||nv(t)||!f||!e||(r=e,!nB(t)&&ni(r,t.target)))return;let{virtualFocus:i,baseElement:a}=e.getState();e.setActiveId(f),r6(t.currentTarget)&&function(e,t=!1){if(r8(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=rZ(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!i||!nB(t)||!r6(n=t.currentTarget)&&("INPUT"!==n.tagName||r9(n))&&(null==a?void 0:a.isConnected)&&((ng()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,t.relatedTarget===a||ni(e,t.relatedTarget))?(a[nn]=!0,a.focus({preventScroll:!0})):a.focus())}),S=c.onBlurCapture,F=nR(t=>{if(null==S||S(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,t.preventDefault(),t.stopPropagation())}),T=c.onKeyDown,R=nL(r),w=nL(n),D=nR(t=>{if(null==T||T(t),t.defaultPrevented||!nB(t)||!e)return;let{currentTarget:r}=t,n=e.getState(),i=e.item(f),a=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,l="vertical"!==n.orientation,s=()=>!(!a&&!l&&n.baseElement&&r8(n.baseElement)),u={ArrowUp:(a||o)&&e.up,ArrowRight:(a||l)&&e.next,ArrowDown:(a||o)&&e.down,ArrowLeft:(a||l)&&e.previous,Home:()=>{if(s())return!a||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(s())return!a||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>aa(r,e,null==e?void 0:e.up,!0),PageDown:()=>aa(r,e,null==e?void 0:e.down)}[t.key];if(u){if(r6(r)){let e=r4(r),n=l&&"ArrowLeft"===t.key,i=l&&"ArrowRight"===t.key,a=o&&"ArrowUp"===t.key,s=o&&"ArrowDown"===t.key;if(i||s){let{length:t}=function(e){if(r8(e))return e.value;if(e.isContentEditable){let t=rZ(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((n||a)&&0!==e.start)return}let n=u();if(R(t)||void 0!==n){if(!w(t))return;t.preventDefault(),e.move(n)}}}),I=(0,o.useMemo)(()=>({id:f,baseElement:g}),[f,g]);return c={id:f,"data-active-item":v||void 0,...c=n_(c,e=>(0,i.jsx)(n1.Provider,{value:I,children:e}),[I]),ref:nw(m,c.ref),tabIndex:y?c.tabIndex:-1,onFocus:M,onBlurCapture:F,onKeyDown:D},c=i4(c),nf({...c=i5({store:e,...c,getItem:b,shouldRegisterItem:!!f&&c.shouldRegisterItem}),"aria-setsize":B,"aria-posinset":C})});nK(nJ(function(e){return nQ("button",ao(e))}));var al=nV(function({store:e,value:t,hideOnClick:r,setValueOnClick:n,selectValueOnClick:a=!0,resetValueOnSelect:l,focusOnHover:s=!1,moveOnKeyPress:u=!0,getItem:c,...d}){var f,m;let h=iP();nu(e=e||h,!1);let{resetValueOnSelectState:p,multiSelectable:A,selected:g}=ar(e,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,t)}),v=(0,o.useCallback)(e=>{let r={...e,value:t};return c?c(r):r},[t,c]);n=null!=n?n:!A,r=null!=r?r:null!=t&&!A;let B=d.onClick,C=nL(n),y=nL(a),b=nL(null!=(f=null!=l?l:p)?f:A),x=nL(r),E=nR(r=>{null==B||B(r),r.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(r)||!function(e){let t=e.currentTarget;if(!t)return!1;let r=nA();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(r)&&(null!=t&&(y(r)&&(b(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),C(r)&&(null==e||e.setValue(t))),x(r)&&(null==e||e.hide()))}),M=d.onKeyDown,S=nR(t=>{if(null==M||M(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||it(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),r8(r)&&(null==e||e.setValue(r.value)))});A&&null!=g&&(d={"aria-selected":g,...d}),d=n_(d,e=>(0,i.jsx)(ij.Provider,{value:t,children:(0,i.jsx)(iU.Provider,{value:null!=g&&g,children:e})}),[t,g]),d={role:null!=(m=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,o.useContext)(iG)])?m:"option",children:t,...d,onClick:E,onKeyDown:S};let F=nL(u);return d=ao({store:e,...d,getItem:v,moveOnKeyPress:t=>{if(!F(t))return!1;let r=new Event("combobox-item-move"),n=null==e?void 0:e.getState().baseElement;return null==n||n.dispatchEvent(r),!0}}),d=i3({store:e,focusOnHover:s,...d})}),as=nK(nJ(function(e){return nQ("div",al(e))})),au=e.i(74080);function ac(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function ad(...e){return e.join(", ").split(", ").reduce((e,t)=>{let r=t.endsWith("ms")?1:1e3,n=Number.parseFloat(t||"0s")*r;return n>e?n:e},0)}function af(e,t,r){return!r&&!1!==t&&(!e||!!t)}var am=nV(function({store:e,alwaysVisible:t,...r}){let n=iy();nu(e=e||n,!1);let a=(0,o.useRef)(null),l=nD(r.id),[s,u]=(0,o.useState)(null),c=e.useState("open"),d=e.useState("mounted"),f=e.useState("animated"),m=e.useState("contentElement"),h=at(e.disclosure,"contentElement");nT(()=>{a.current&&(null==e||e.setContentElement(a.current))},[e]),nT(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),nT(()=>{if(f){var e;let t;return(null==m?void 0:m.isConnected)?(e=()=>{u(c?"enter":d?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void u(null)}},[f,m,c,d]),nT(()=>{if(!e||!f||!s||!m)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,au.flushSync)(t);if("leave"===s&&c||"enter"===s&&!c)return;if("number"==typeof f)return ac(f,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:o}=getComputedStyle(m),{transitionDuration:l="0",animationDuration:u="0",transitionDelay:d="0",animationDelay:p="0"}=h?getComputedStyle(h):{},A=ad(a,o,d,p)+ad(n,i,l,u);if(!A){"enter"===s&&e.setState("animated",!1),t();return}return ac(Math.max(A-1e3/60,0),r)},[e,f,m,h,c,s]);let p=af(d,(r=n_(r,t=>(0,i.jsx)(iM,{value:e,children:t}),[e])).hidden,t),A=r.style,g=(0,o.useMemo)(()=>p?{...A,display:"none"}:A,[p,A]);return nf(r={id:l,"data-open":c||void 0,"data-enter":"enter"===s||void 0,"data-leave":"leave"===s||void 0,hidden:p,...r,ref:nw(l?e.setContentElement:null,a,r.ref),style:g})}),ah=nJ(function(e){return nQ("div",am(e))});nJ(function({unmountOnHide:e,...t}){let r=iy();return!1===at(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,i.jsx)(ah,{...t})});var ap=nV(function({store:e,alwaysVisible:t,...r}){let n=iP(!0),a=i_(),l=!!(e=e||a)&&e===n;nu(e,!1);let s=(0,o.useRef)(null),u=nD(r.id),c=e.useState("mounted"),d=af(c,r.hidden,t),f=d?{...r.style,display:"none"}:r.style,m=e.useState(e=>Array.isArray(e.selectedValue)),h=function(e,t,r){let n=function(e){let[t]=(0,o.useState)(e);return t}(r),[i,a]=(0,o.useState)(n);return(0,o.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},o=new MutationObserver(i);return o.observe(r,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,n]),i}(s,"role",r.role),p="listbox"===h||"tree"===h||"grid"===h,[A,g]=(0,o.useState)(!1),v=e.useState("contentElement");nT(()=>{if(!c)return;let e=s.current;if(!e||v!==e)return;let t=()=>{g(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[c,v]),A||(r={role:"listbox","aria-multiselectable":p&&m||void 0,...r}),r=n_(r,t=>(0,i.jsx)(iH,{value:e,children:(0,i.jsx)(iG.Provider,{value:h,children:t})}),[e,h]);let B=!u||n&&l?null:e.setContentElement;return nf(r={id:u,hidden:d,...r,ref:nw(B,s,r.ref),style:f})}),aA=nJ(function(e){return nQ("div",ap(e))}),ag=(0,o.createContext)(null),av=nV(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});nJ(function(e){return nQ("span",av(e))});var aB=nV(function(e){return av(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),aC=nJ(function(e){return nQ("span",aB(e))});function ay(e){queueMicrotask(()=>{null==e||e.focus()})}var ab=nV(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:n,portal:a=!0,...l}){let s=(0,o.useRef)(null),u=nw(s,l.ref),c=(0,o.useContext)(ag),[d,f]=(0,o.useState)(null),[m,h]=(0,o.useState)(null),p=(0,o.useRef)(null),A=(0,o.useRef)(null),g=(0,o.useRef)(null),v=(0,o.useRef)(null);return nT(()=>{let e=s.current;if(!e||!a)return void f(null);let t=r?"function"==typeof r?r(e):r:rZ(e).createElement("div");if(!t)return void f(null);let i=t.isConnected;if(i||(c||rZ(e).body).appendChild(t),t.id||(t.id=e.id?`portal/${e.id}`:function(e="id"){return`${e?`${e}-`:""}${Math.random().toString(36).slice(2,8)}`}()),f(t),nh(n,t),!i)return()=>{t.remove(),nh(n,null)}},[a,r,c,n]),nT(()=>{if(!a||!e||!t)return;let r=rZ(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),h(r),()=>{r.remove(),h(null)}},[a,e,t]),(0,o.useEffect)(()=>{if(!d||!e)return;let t=0,r=e=>{if(!nb(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=d.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(d.hasAttribute("data-tabindex")&&t(d),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of n4(d,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return d.addEventListener("focusin",r,!0),d.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),d.removeEventListener("focusin",r,!0),d.removeEventListener("focusout",r,!0)}},[d,e]),l={...l=n_(l,t=>{if(t=(0,i.jsx)(ag.Provider,{value:d||c,children:t}),!a)return t;if(!d)return(0,i.jsx)("span",{ref:u,id:l.id,style:{position:"fixed"},hidden:!0});t=(0,i.jsxs)(i.Fragment,{children:[e&&d&&(0,i.jsx)(aC,{ref:A,"data-focus-trap":l.id,className:"__focus-trap-inner-before",onFocus:e=>{nb(e,d)?ay(n7()):ay(p.current)}}),t,e&&d&&(0,i.jsx)(aC,{ref:g,"data-focus-trap":l.id,className:"__focus-trap-inner-after",onFocus:e=>{nb(e,d)?ay(ie()):ay(v.current)}})]}),d&&(t=(0,au.createPortal)(t,d));let r=(0,i.jsxs)(i.Fragment,{children:[e&&d&&(0,i.jsx)(aC,{ref:p,"data-focus-trap":l.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==v.current&&nb(e,d)?ay(A.current):ay(ie())}}),e&&(0,i.jsx)("span",{"aria-owns":null==d?void 0:d.id,style:{position:"fixed"}}),e&&d&&(0,i.jsx)(aC,{ref:v,"data-focus-trap":l.id,className:"__focus-trap-outer-after",onFocus:e=>{if(nb(e,d))ay(g.current);else{let e=n7();if(e===A.current)return void requestAnimationFrame(()=>{var e;return null==(e=n7())?void 0:e.focus()});ay(e)}}})]});return m&&e&&(r=(0,au.createPortal)(r,m)),(0,i.jsxs)(i.Fragment,{children:[r,t]})},[d,c,a,l.id,e,m]),ref:u}});nJ(function(e){return nQ("div",ab(e))});var ax=(0,o.createContext)(0);function aE({level:e,children:t}){let r=(0,o.useContext)(ax),n=Math.max(Math.min(e||r+1,6),1);return(0,i.jsx)(ax.Provider,{value:n,children:t})}var aM=nV(function({autoFocusOnShow:e=!0,...t}){return n_(t,t=>(0,i.jsx)(n9.Provider,{value:e,children:t}),[e])});nJ(function(e){return nQ("div",aM(e))});var aS=new WeakMap;function aF(e,t,r){aS.has(e)||aS.set(e,new Map);let n=aS.get(e),i=n.get(t);if(!i)return n.set(t,r()),()=>{var e;null==(e=n.get(t))||e(),n.delete(t)};let a=r(),o=()=>{a(),i(),n.delete(t)};return n.set(t,o),()=>{n.get(t)===o&&(a(),n.set(t,i))}}function aT(e,t,r){return aF(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function aR(e,t,r){return aF(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function aw(e,t){return e?aF(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var aD=["SCRIPT","STYLE"];function aI(e){return`__ariakit-dialog-snapshot-${e}`}function aG(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),o=rZ(i),l=i;for(;i.parentElement&&i!==o.body;){if(null==n||n(i.parentElement,l),!a)for(let n of i.parentElement.children)(function(e,t,r){return!aD.includes(t.tagName)&&!!function(e,t){let r=rZ(t),n=aI(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&r1(t,e))})(e,n,t)&&r(n,l);i=i.parentElement}}}function aL(e,...t){if(!e)return!1;let r=e.getAttribute("data-backdrop");return null!=r&&(""===r||"true"===r||!t.length||t.some(e=>r===e))}function a_(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function aP(e,t=""){return nl(aR(e,a_("",!0),!0),aR(e,a_(t,!0),!0))}function aO(e,t){if(e[a_(t,!0)])return!0;let r=a_(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function ak(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return aG(e,t,t=>{aL(t,...n)||r.unshift(function(e,t=""){return nl(aR(e,a_(),!0),aR(e,a_(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(aP(t,e))}),()=>{for(let e of r)e()}}function aH({store:e,type:t,listener:r,capture:n,domReady:i}){let a=nR(r),l=at(e,"open"),s=(0,o.useRef)(!1);nT(()=>{if(!l||!i)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{s.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,l,i]),(0,o.useEffect)(()=>{if(l)return nE(t,t=>{let{contentElement:r,disclosureElement:n}=e.getState(),i=t.target;!r||!i||!(!("HTML"===i.tagName||r1(rZ(i).body,i))||r1(r,i)||function(e,t){if(!e)return!1;if(r1(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=rZ(e).getElementById(r);if(t)return r1(e,t)}return!1}(n,i)||i.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(t,r))&&(!s.current||aO(i,r.id))&&(i&&i[il]||a(t))},n)},[l,n])}function aj(e,t){return"function"==typeof e?e(t):!!e}var aU=(0,o.createContext)({});function aN(){return"inert"in HTMLElement.prototype}function aJ(e,t){if(!("style"in e))return na;if(aN())return aR(e,"inert",!0);let r=n4(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&r1(t,e)))return na;let r=aF(e,"focus",()=>(e.focus=na,()=>{delete e.focus}));return nl(aT(e,"tabindex","-1"),r)});return nl(...r,aT(e,"aria-hidden","true"),aw(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function aK(e={}){let t=iY(e.store,iW(e.disclosure,["contentElement","disclosureElement"]));iz(e,t);let r=null==t?void 0:t.getState(),n=nm(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=nm(e.animated,null==r?void 0:r.animated,!1),a=iJ({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:nm(null==r?void 0:r.contentElement,null),disclosureElement:nm(null==r?void 0:r.disclosureElement,null)},t);return iK(a,()=>iX(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),iK(a,()=>iV(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),iK(a,()=>iX(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)}}function aQ(e,t,r){return nI(t,[r.store,r.disclosure]),an(e,r,"open","setOpen"),an(e,r,"mounted","setMounted"),an(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}nV(function(e){return e});var aV=nJ(function(e){return nQ("div",e)});function aX({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let a=(0,o.useRef)(null),l=function(e={}){let[t,r]=ai(aK,e);return aQ(t,r,e)}({disclosure:e}),s=at(e,"contentElement");(0,o.useEffect)(()=>{let e=a.current;!e||s&&(e.style.zIndex=getComputedStyle(s).zIndex)},[s]),nT(()=>{let e=null==s?void 0:s.id;if(!e)return;let t=a.current;if(t)return aP(t,e)},[s]);let u=am({ref:a,store:l,role:"presentation","data-backdrop":(null==s?void 0:s.id)||"",alwaysVisible:r,hidden:null!=n?n:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!t)return null;if((0,o.isValidElement)(t))return(0,i.jsx)(aV,{...u,render:t});let c="boolean"!=typeof t?t:"div";return(0,i.jsx)(aV,{...u,render:(0,i.jsx)(c,{})})}function aq(e={}){return aK(e)}Object.assign(aV,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=nJ(function(e){return nQ(t,e)}),e),{}));var aW=ng();function aY(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?n5(r)?r:null:r:null}var az=nV(function({store:e,open:t,onClose:r,focusable:n=!0,modal:a=!0,portal:l=!!a,backdrop:s=!!a,hideOnEscape:u=!0,hideOnInteractOutside:c=!0,getPersistentElements:d,preventBodyScroll:f=!!a,autoFocusOnShow:m=!0,autoFocusOnHide:h=!0,initialFocus:p,finalFocus:A,unmountOnHide:g,unstable_treeSnapshotKey:v,...B}){var C;let y,b,x,E=ix(),M=(0,o.useRef)(null),S=function(e={}){let[t,r]=ai(aq,e);return aQ(t,r,e)}({store:e||E,open:t,setOpen(e){if(e)return;let t=M.current;if(!t)return;let n=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&S.setOpen(!0)}}),{portalRef:F,domReady:T}=nP(l,B.portalRef),R=B.preserveTabOrder,w=at(S,e=>R&&!a&&e.mounted),D=nD(B.id),I=at(S,"open"),G=at(S,"mounted"),L=at(S,"contentElement"),_=af(G,B.hidden,B.alwaysVisible);y=function({attribute:e,contentId:t,contentElement:r,enabled:n}){let[i,a]=nG(),l=(0,o.useCallback)(()=>{if(!n||!r)return!1;let{body:i}=rZ(r),a=i.getAttribute(e);return!a||a===t},[i,n,r,e,t]);return(0,o.useEffect)(()=>{if(!n||!t||!r)return;let{body:i}=rZ(r);if(l())return i.setAttribute(e,t),()=>i.removeAttribute(e);let o=new MutationObserver(()=>(0,au.flushSync)(a));return o.observe(i,{attributeFilter:[e]}),()=>o.disconnect()},[i,n,t,r,l,e]),l}({attribute:"data-dialog-prevent-body-scroll",contentElement:L,contentId:D,enabled:f&&!_}),(0,o.useEffect)(()=>{var e,t;if(!y()||!L)return;let r=rZ(L),n=r$(L),{documentElement:i,body:a}=r,o=i.style.getPropertyValue("--scrollbar-width"),l=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,s=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=nA()&&!(rz&&navigator.platform.startsWith("Mac")&&!np());return nl((e="--scrollbar-width",t=`${l}px`,i?aF(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:o}=n,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=aw(a,{position:"fixed",overflow:"hidden",top:`${-(i-Math.floor(c))}px`,left:`${-(r-Math.floor(u))}px`,right:"0",[s]:`${l}px`});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():aw(a,{overflow:"hidden",[s]:`${l}px`}))},[y,L]),C=at(S,"open"),b=(0,o.useRef)(),(0,o.useEffect)(()=>{if(!C){b.current=null;return}return nE("mousedown",e=>{b.current=e.target},!0)},[C]),aH({...x={store:S,domReady:T,capture:!0},type:"click",listener:e=>{let{contentElement:t}=S.getState(),r=b.current;r&&r5(r)&&aO(r,null==t?void 0:t.id)&&aj(c,e)&&S.hide()}}),aH({...x,type:"focusin",listener:e=>{let{contentElement:t}=S.getState();!t||e.target===rZ(t)||aj(c,e)&&S.hide()}}),aH({...x,type:"contextmenu",listener:e=>{aj(c,e)&&S.hide()}});let{wrapElement:P,nestedDialogs:O}=function(e){let t=(0,o.useContext)(aU),[r,n]=(0,o.useState)([]),a=(0,o.useCallback)(e=>{var r;return n(t=>[...t,e]),nl(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);nT(()=>iX(e,["open","contentElement"],r=>{var n;if(r.open&&r.contentElement)return null==(n=t.add)?void 0:n.call(t,e)}),[e,t]);let l=(0,o.useMemo)(()=>({store:e,add:a}),[e,a]);return{wrapElement:(0,o.useCallback)(e=>(0,i.jsx)(aU.Provider,{value:l,children:e}),[l]),nestedDialogs:r}}(S);B=n_(B,P,[P]),nT(()=>{if(!I)return;let e=M.current,t=r0(e,!0);!t||"BODY"===t.tagName||e&&r1(e,t)||S.setDisclosureElement(t)},[S,I]),aW&&(0,o.useEffect)(()=>{if(!G)return;let{disclosureElement:e}=S.getState();if(!e||!r9(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),nx(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||ii(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[S,G]),(0,o.useEffect)(()=>{if(!G||!T)return;let e=M.current;if(!e)return;let t=r$(e),r=t.visualViewport||t,n=()=>{var r,n;let i=null!=(n=null==(r=t.visualViewport)?void 0:r.height)?n:t.innerHeight;e.style.setProperty("--dialog-viewport-height",`${i}px`)};return n(),r.addEventListener("resize",n),()=>{r.removeEventListener("resize",n)}},[G,T]),(0,o.useEffect)(()=>{if(!a||!G||!T)return;let e=M.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=S.hide,(r=rZ(e).createElement("button")).type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[S,a,G,T]),nT(()=>{if(!aN()||I||!G||!T)return;let e=M.current;if(e)return aJ(e)},[I,G,T]);let k=I&&T;nT(()=>{if(D&&k)return function(e,t){let{body:r}=rZ(t[0]),n=[];return aG(e,t,t=>{n.push(aR(t,aI(e),!0))}),nl(aR(r,aI(e),!0),()=>{for(let e of n)e()})}(D,[M.current])},[D,k,v]);let H=nR(d);nT(()=>{if(!D||!k)return;let{disclosureElement:e}=S.getState(),t=[M.current,...H()||[],...O.map(e=>e.getState().contentElement)];if(a){let e,r;return nl(ak(D,t),(e=[],r=t.map(e=>null==e?void 0:e.id),aG(D,t,n=>{aL(n,...r)||!function(e,...t){if(!e)return!1;let r=e.getAttribute("data-focus-trap");return null!=r&&(!t.length||""!==r&&t.some(e=>r===e))}(n,...r)&&e.unshift(aJ(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&r1(e,r))||e.unshift(aT(r,"role","none"))}),()=>{for(let t of e)t()}))}return ak(D,[e,...t])},[D,S,k,H,O,a,v]);let j=!!m,U=nL(m),[N,J]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(!I||!j||!T||!(null==L?void 0:L.isConnected))return;let e=aY(p,!0)||L.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=n4(e,t,r);return n||null}(L,!0,l&&w)||L,t=n5(e);U(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!aW||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[I,j,T,L,p,l,w,U]);let K=!!h,Q=nL(h),[V,X]=(0,o.useState)(!1);(0,o.useEffect)(()=>{if(I)return X(!0),()=>X(!1)},[I]);let q=(0,o.useCallback)((e,t=!0)=>{let r,{disclosureElement:n}=S.getState();if(!(!(r=r0())||e&&r1(e,r))&&n5(r))return;let i=aY(A)||n;if(null==i?void 0:i.id){let e=rZ(i),t=`[aria-activedescendant="${i.id}"]`,r=e.querySelector(t);r&&(i=r)}if(i&&!n5(i)){let e=i.closest("[data-dialog]");if(null==e?void 0:e.id){let t=rZ(e),r=`[aria-controls~="${e.id}"]`,n=t.querySelector(r);n&&(i=n)}}let a=i&&n5(i);!a&&t?requestAnimationFrame(()=>q(e,!1)):!Q(a?i:null)||a&&(null==i||i.focus({preventScroll:!0}))},[S,A,Q]),W=(0,o.useRef)(!1);nT(()=>{if(I||!V||!K)return;let e=M.current;W.current=!0,q(e)},[I,V,T,K,q]),(0,o.useEffect)(()=>{if(!V||!K)return;let e=M.current;return()=>{if(W.current){W.current=!1;return}q(e)}},[V,K,q]);let Y=nL(u);(0,o.useEffect)(()=>{if(T&&G)return nE("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=M.current;if(!t||aO(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=S.getState();!("BODY"===r.tagName||r1(t,r)||!n||r1(n,r))||Y(e)&&S.hide()},!0)},[S,T,G,Y]);let z=(B=n_(B,e=>(0,i.jsx)(aE,{level:a?1:void 0,children:e}),[a])).hidden,Z=B.alwaysVisible;B=n_(B,e=>s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(aX,{store:S,backdrop:s,hidden:z,alwaysVisible:Z}),e]}):e,[S,s,z,Z]);let[$,ee]=(0,o.useState)(),[et,er]=(0,o.useState)();return B=aM({...B={id:D,"data-dialog":"",role:"dialog",tabIndex:n?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...B=n_(B,e=>(0,i.jsx)(iM,{value:S,children:(0,i.jsx)(iS.Provider,{value:ee,children:(0,i.jsx)(iF.Provider,{value:er,children:e})})}),[S]),ref:nw(M,B.ref)},autoFocusOnShow:N}),B=ab({portal:l,...B=ip({...B=am({store:S,...B}),focusable:n}),portalRef:F,preserveTabOrder:w})});function aZ(e,t=ix){return nJ(function(r){let n=t();return at(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,i.jsx)(e,{...r}):null})}aZ(nJ(function(e){return nQ("div",az(e))}),ix);let a$=Math.min,a0=Math.max,a1=Math.round,a2=Math.floor,a9=e=>({x:e,y:e}),a3={left:"right",right:"left",bottom:"top",top:"bottom"},a5={start:"end",end:"start"};function a8(e,t){return"function"==typeof e?e(t):e}function a6(e){return e.split("-")[0]}function a4(e){return e.split("-")[1]}function a7(e){return"x"===e?"y":"x"}function oe(e){return"y"===e?"height":"width"}let ot=new Set(["top","bottom"]);function or(e){return ot.has(a6(e))?"y":"x"}function on(e){return e.replace(/start|end/g,e=>a5[e])}let oi=["left","right"],oa=["right","left"],oo=["top","bottom"],ol=["bottom","top"];function os(e){return e.replace(/left|right|bottom|top/g,e=>a3[e])}function ou(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oc(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function od(e,t,r){let n,{reference:i,floating:a}=e,o=or(t),l=a7(or(t)),s=oe(l),u=a6(t),c="y"===o,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,m=i[s]/2-a[s]/2;switch(u){case"top":n={x:d,y:i.y-a.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:f};break;case"left":n={x:i.x-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(a4(t)){case"start":n[l]-=m*(r&&c?-1:1);break;case"end":n[l]+=m*(r&&c?-1:1)}return n}let of=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,l=a.filter(Boolean),s=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=od(u,n,s),f=n,m={},h=0;for(let r=0;r{try{return e.matches(t)}catch(e){return!1}})}let oR=["transform","translate","scale","rotate","perspective"],ow=["transform","translate","scale","rotate","perspective","filter"],oD=["paint","layout","strict","content"];function oI(e){let t=oG(),r=oy(e)?oP(e):e;return oR.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||ow.some(e=>(r.willChange||"").includes(e))||oD.some(e=>(r.contain||"").includes(e))}function oG(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let oL=new Set(["html","body","#document"]);function o_(e){return oL.has(og(e))}function oP(e){return ov(e).getComputedStyle(e)}function oO(e){return oy(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ok(e){if("html"===og(e))return e;let t=e.assignedSlot||e.parentNode||ox(e)&&e.host||oB(e);return ox(t)?t.host:t}function oH(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=ok(t);return o_(r)?t.ownerDocument?t.ownerDocument.body:t.body:ob(r)&&oM(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=ov(i);if(a){let e=oj(o);return t.concat(o,o.visualViewport||[],oM(i)?i:[],e&&r?oH(e):[])}return t.concat(i,oH(i,[],r))}function oj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oU(e){let t=oP(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=ob(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,l=a1(r)!==a||a1(n)!==o;return l&&(r=a,n=o),{width:r,height:n,$:l}}function oN(e){return oy(e)?e:e.contextElement}function oJ(e){let t=oN(e);if(!ob(t))return a9(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=oU(t),o=(a?a1(r.width):r.width)/n,l=(a?a1(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),l&&Number.isFinite(l)||(l=1),{x:o,y:l}}let oK=a9(0);function oQ(e){let t=ov(e);return oG()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oK}function oV(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=oN(e),l=a9(1);t&&(n?oy(n)&&(l=oJ(n)):l=oJ(e));let s=(void 0===(i=r)&&(i=!1),n&&(!i||n===ov(o))&&i)?oQ(o):a9(0),u=(a.left+s.x)/l.x,c=(a.top+s.y)/l.y,d=a.width/l.x,f=a.height/l.y;if(o){let e=ov(o),t=n&&oy(n)?ov(n):n,r=e,i=oj(r);for(;i&&n&&t!==r;){let e=oJ(i),t=i.getBoundingClientRect(),n=oP(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=o,i=oj(r=ov(i))}}return oc({width:d,height:f,x:u,y:c})}function oX(e,t){let r=oO(e).scrollLeft;return t?t.left+r:oV(oB(e)).left+r}function oq(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-oX(e,r),y:r.top+t.scrollTop}}let oW=new Set(["absolute","fixed"]);function oY(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=ov(e),n=oB(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,l=0,s=0;if(i){a=i.width,o=i.height;let e=oG();(!e||e&&"fixed"===t)&&(l=i.offsetLeft,s=i.offsetTop)}let u=oX(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:l,y:s}}(e,r);else if("document"===t){let t,r,a,o,l,s,u;n=oB(e),t=oB(n),r=oO(n),a=n.ownerDocument.body,o=a0(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=a0(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+oX(n),u=-r.scrollTop,"rtl"===oP(a).direction&&(s+=a0(t.clientWidth,a.clientWidth)-o),i={width:o,height:l,x:s,y:u}}else if(oy(t)){let e,n,a,o,l,s;n=(e=oV(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=ob(t)?oJ(t):a9(1),l=t.clientWidth*o.x,s=t.clientHeight*o.y,i={width:l,height:s,x:a*o.x,y:n*o.y}}else{let r=oQ(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oc(i)}function oz(e){return"static"===oP(e).position}function oZ(e,t){if(!ob(e)||"fixed"===oP(e).position)return null;if(t)return t(e);let r=e.offsetParent;return oB(e)===r&&(r=r.ownerDocument.body),r}function o$(e,t){var r;let n=ov(e);if(oT(e))return n;if(!ob(e)){let t=ok(e);for(;t&&!o_(t);){if(oy(t)&&!oz(t))return t;t=ok(t)}return n}let i=oZ(e,t);for(;i&&(r=i,oS.has(og(r)))&&oz(i);)i=oZ(i,t);return i&&o_(i)&&oz(i)&&!oI(i)?n:i||function(e){let t=ok(e);for(;ob(t)&&!o_(t);){if(oI(t))return t;if(oT(t))break;t=ok(t)}return null}(e)||n}let o0=async function(e){let t=this.getOffsetParent||o$,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=ob(t),i=oB(t),a="fixed"===r,o=oV(e,!0,a,t),l={scrollLeft:0,scrollTop:0},s=a9(0);if(n||!n&&!a)if(("body"!==og(t)||oM(i))&&(l=oO(t)),n){let e=oV(t,!0,a,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else i&&(s.x=oX(i));a&&!n&&i&&(s.x=oX(i));let u=!i||n||a?a9(0):oq(i,l);return{x:o.left+l.scrollLeft-s.x-u.x,y:o.top+l.scrollTop-s.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},o1={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=oB(n),l=!!t&&oT(t.floating);if(n===o||l&&a)return r;let s={scrollLeft:0,scrollTop:0},u=a9(1),c=a9(0),d=ob(n);if((d||!d&&!a)&&(("body"!==og(n)||oM(o))&&(s=oO(n)),ob(n))){let e=oV(n);u=oJ(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?a9(0):oq(o,s);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-s.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-s.scrollTop*u.y+c.y+f.y}},getDocumentElement:oB,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?oT(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=oH(e,[],!1).filter(e=>oy(e)&&"body"!==og(e)),i=null,a="fixed"===oP(e).position,o=a?ok(e):e;for(;oy(o)&&!o_(o);){let t=oP(o),r=oI(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&oW.has(i.position)||oM(o)&&!r&&function e(t,r){let n=ok(t);return!(n===r||!oy(n)||o_(n))&&("fixed"===oP(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=ok(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],l=a.reduce((e,r)=>{let n=oY(t,r,i);return e.top=a0(n.top,e.top),e.right=a$(n.right,e.right),e.bottom=a$(n.bottom,e.bottom),e.left=a0(n.left,e.left),e},oY(t,o,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:o$,getElementRects:o0,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=oU(e);return{width:t,height:r}},getScale:oJ,isElement:oy,isRTL:function(e){return"rtl"===oP(e).direction}};function o2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o9(e=0,t=0,r=0,n=0){if("function"==typeof DOMRect)return new DOMRect(e,t,r,n);let i={x:e,y:t,width:r,height:n,top:t,right:e+r,bottom:t+n,left:e};return{...i,toJSON:()=>i}}function o3(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function o5(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var o8=nV(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:n=!0,autoFocusOnShow:a=!0,wrapperProps:l,fixed:s=!1,flip:u=!0,shift:c=0,slide:d=!0,overlap:f=!1,sameWidth:m=!1,fitViewport:h=!1,gutter:p,arrowPadding:A=4,overflowPadding:g=8,getAnchorRect:v,updatePosition:B,...C}){let y=iR();nu(e=e||y,!1);let b=e.useState("arrowElement"),x=e.useState("anchorElement"),E=e.useState("disclosureElement"),M=e.useState("popoverElement"),S=e.useState("contentElement"),F=e.useState("placement"),T=e.useState("mounted"),R=e.useState("rendered"),w=(0,o.useRef)(null),[D,I]=(0,o.useState)(!1),{portalRef:G,domReady:L}=nP(r,C.portalRef),_=nR(v),P=nR(B),O=!!B;nT(()=>{if(!(null==M?void 0:M.isConnected))return;M.style.setProperty("--popover-overflow-padding",`${g}px`);let t={contextElement:x||void 0,getBoundingClientRect:()=>{let e=null==_?void 0:_(x);return e||!x?function(e){if(!e)return o9();let{x:t,y:r,width:n,height:i}=e;return o9(t,r,n,i)}(e):x.getBoundingClientRect()}},r=async()=>{var r,n,i,a,o;let l,v,B;if(!T)return;b||(w.current=w.current||document.createElement("div"));let C=b||w.current,y=[(r={gutter:p,shift:c},void 0===(n=({placement:e})=>{var t;let n=((null==C?void 0:C.clientHeight)||0)/2,i="number"==typeof r.gutter?r.gutter+n:null!=(t=r.gutter)?t:n;return{crossAxis:e.split("-")[1]?void 0:r.shift,mainAxis:i,alignmentAxis:r.shift}})&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:a,placement:o,middlewareData:l}=e,s=await op(e,n);return o===(null==(t=l.offset)?void 0:t.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:i+s.x,y:a+s.y,data:{...s,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return nu(!r||r.every(o3),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,o,l,s,u;let c,d,f,{placement:m,middlewareData:h,rects:p,initialPlacement:A,platform:g,elements:v}=e,{mainAxis:B=!0,crossAxis:C=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:E=!0,...M}=a8(t,e);if(null!=(r=h.arrow)&&r.alignmentOffset)return{};let S=a6(m),F=or(A),T=a6(A)===A,R=await (null==g.isRTL?void 0:g.isRTL(v.floating)),w=y||(T||!E?[os(A)]:(c=os(A),[on(A),c,on(c)])),D="none"!==x;!y&&D&&w.push(...(d=a4(A),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?oa:oi;return t?oi:oa;case"left":case"right":return t?oo:ol;default:return[]}}(a6(A),"start"===x,R),d&&(f=f.map(e=>e+"-"+d),E&&(f=f.concat(f.map(on)))),f));let I=[A,...w],G=await om(e,M),L=[],_=(null==(n=h.flip)?void 0:n.overflows)||[];if(B&&L.push(G[S]),C){let e,t,r,n,i=(l=m,s=p,void 0===(u=R)&&(u=!1),e=a4(l),r=oe(t=a7(or(l))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",s.reference[r]>s.floating[r]&&(n=os(n)),[n,os(n)]);L.push(G[i[0]],G[i[1]])}if(_=[..._,{placement:m,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=h.flip)?void 0:i.index)||0)+1,t=I[e];if(t&&("alignment"!==C||F===or(t)||_.every(e=>or(e.placement)!==F||e.overflows[0]>0)))return{data:{index:e,overflows:_},reset:{placement:t}};let r=null==(a=_.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(b){case"bestFit":{let e=null==(o=_.filter(e=>{if(D){let t=or(e.placement);return t===F||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=A}if(m!==r)return{reset:{placement:r}}}return{}}}}({flip:u,overflowPadding:g}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:i,rects:a,middlewareData:o}=e,{offset:l=0,mainAxis:s=!0,crossAxis:u=!0}=a8(t,e),c={x:r,y:n},d=or(i),f=a7(d),m=c[f],h=c[d],p=a8(l,e),A="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(s){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+A.mainAxis,r=a.reference[f]+a.reference[e]-A.mainAxis;mr&&(m=r)}if(u){var g,v;let e="y"===f?"width":"height",t=oh.has(a6(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(g=o.offset)?void 0:g[d])||0)+(t?0:A.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[d])||0)-(t?A.crossAxis:0);hn&&(h=n)}return{[f]:m,[d]:h}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...s}=a8(r,e),u={x:t,y:n},c=await om(e,s),d=or(a6(i)),f=a7(d),m=u[f],h=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=m+c[e],n=m-c[t];m=a0(r,a$(m,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=h+c[e],n=h-c[t];h=a0(r,a$(h,n))}let p=l.fn({...e,[f]:m,[d]:h});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[f]:a,[d]:o}}}}}}}({slide:d,shift:c,overlap:f,overflowPadding:g}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:n,placement:i,rects:a,platform:o,elements:l,middlewareData:s}=e,{element:u,padding:c=0}=a8(r,e)||{};if(null==u)return{};let d=ou(c),f={x:t,y:n},m=a7(or(i)),h=oe(m),p=await o.getDimensions(u),A="y"===m,g=A?"clientHeight":"clientWidth",v=a.reference[h]+a.reference[m]-f[m]-a.floating[h],B=f[m]-a.reference[m],C=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),y=C?C[g]:0;y&&await (null==o.isElement?void 0:o.isElement(C))||(y=l.floating[g]||a.floating[h]);let b=y/2-p[h]/2-1,x=a$(d[A?"top":"left"],b),E=a$(d[A?"bottom":"right"],b),M=y-p[h]-E,S=y/2-p[h]/2+(v/2-B/2),F=a0(x,a$(S,M)),T=!s.arrow&&null!=a4(i)&&S!==F&&a.reference[h]/2-(S{},...d}=a8(a,e),f=await om(e,d),m=a6(o),h=a4(o),p="y"===or(o),{width:A,height:g}=l.floating;"top"===m||"bottom"===m?(n=m,i=h===(await (null==s.isRTL?void 0:s.isRTL(u.floating))?"start":"end")?"left":"right"):(i=m,n="end"===h?"top":"bottom");let v=g-f.top-f.bottom,B=A-f.left-f.right,C=a$(g-f[n],v),y=a$(A-f[i],B),b=!e.middlewareData.shift,x=C,E=y;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(E=B),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=v),b&&!h){let e=a0(f.left,0),t=a0(f.right,0),r=a0(f.top,0),n=a0(f.bottom,0);p?E=A-2*(0!==e||0!==t?e+t:a0(f.left,f.right)):x=g-2*(0!==r||0!==n?r+n:a0(f.top,f.bottom))}await c({...e,availableWidth:E,availableHeight:x});let M=await s.getDimensions(u.floating);return A!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}],x=await (o={placement:F,strategy:s?"fixed":"absolute",middleware:y},l=new Map,B={...(v={platform:o1,...o}).platform,_c:l},of(t,M,{...v,platform:B}));null==e||e.setState("currentPlacement",x.placement),I(!0);let E=o5(x.x),S=o5(x.y);if(Object.assign(M.style,{top:"0",left:"0",transform:`translate3d(${E}px,${S}px,0)`}),C&&x.middlewareData.arrow){let{x:e,y:t}=x.middlewareData.arrow,r=x.placement.split("-")[0],n=C.clientWidth/2,i=C.clientHeight/2,a=null!=e?e+n:-n,o=null!=t?t+i:-i;M.style.setProperty("--popover-transform-origin",{top:`${a}px calc(100% + ${i}px)`,bottom:`${a}px ${-i}px`,left:`calc(100% + ${n}px) ${o}px`,right:`${-n}px ${o}px`}[r]),Object.assign(C.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[r]:"100%"})}},n=function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=oN(e),d=a||o?[...c?oH(c):[],...oH(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&s?function(e,t){let r,n=null,i=oB(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:m}=u;if(l||t(),!f||!m)return;let h={rootMargin:-a2(d)+"px "+-a2(i.clientWidth-(c+f))+"px "+-a2(i.clientHeight-(d+m))+"px "+-a2(c)+"px",threshold:a0(0,a$(1,s))||1},p=!0;function A(t){let n=t[0].intersectionRatio;if(n!==s){if(!p)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||o2(u,e.getBoundingClientRect())||o(),p=!1}try{n=new IntersectionObserver(A,{...h,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(A,h)}n.observe(e)}(!0),a}(c,r):null,m=-1,h=null;l&&(h=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),r()}),c&&!u&&h.observe(c),h.observe(t));let p=u?oV(e):null;return u&&function t(){let n=oV(e);p&&!o2(p,n)&&r(),p=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=h)||e.disconnect(),h=null,u&&cancelAnimationFrame(i)}}(t,M,async()=>{O?(await P({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[e,R,M,b,x,M,F,T,L,s,u,c,d,f,m,h,p,A,g,_,O,P]),nT(()=>{if(!T||!L||!(null==M?void 0:M.isConnected)||!(null==S?void 0:S.isConnected))return;let e=()=>{M.style.zIndex=getComputedStyle(S).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,M,S]);let k=s?"fixed":"absolute";return C=n_(C,t=>(0,i.jsx)("div",{...l,style:{position:k,top:0,left:0,width:"max-content",...null==l?void 0:l.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,k,l]),C={"data-placing":!D||void 0,...C=n_(C,t=>(0,i.jsx)(iD,{value:e,children:t}),[e]),style:{position:"relative",...C.style}},C=az({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:E||x,autoFocusOnShow:D&&a,...C,portalRef:G})});aZ(nJ(function(e){return nQ("div",o8(e))}),iR);var o6=nV(function({store:e,modal:t,tabIndex:r,alwaysVisible:n,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...l}){let s=iO();nu(e=e||s,!1);let u=e.useState("baseElement"),c=(0,o.useRef)(!1),d=at(e.tag,e=>null==e?void 0:e.renderedItems.length);return l=ap({store:e,alwaysVisible:n,...l}),l=o8({store:e,modal:t,alwaysVisible:n,backdrop:!1,autoFocusOnShow:!1,finalFocus:u,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:d,...l,getPersistentElements(){var r;let n=(null==(r=l.getPersistentElements)?void 0:r.call(l))||[];if(!t||!e)return n;let{contentElement:i,baseElement:a}=e.getState();if(!a)return n;let o=rZ(a),s=[];if((null==i?void 0:i.id)&&s.push(`[aria-controls~="${i.id}"]`),(null==a?void 0:a.id)&&s.push(`[aria-controls~="${a.id}"]`),!s.length)return[...n,a];let u=s.join(",");return[...n,...o.querySelectorAll(u)]},autoFocusOnHide:e=>!nc(i,e)&&(!c.current||(c.current=!1,!1)),hideOnInteractOutside(t){var r,n;let i=null==e?void 0:e.getState(),o=null==(r=null==i?void 0:i.contentElement)?void 0:r.id,l=null==(n=null==i?void 0:i.baseElement)?void 0:n.id;if(function(e,...t){if(!e)return!1;if("id"in e){let r=t.filter(Boolean).map(e=>`[aria-controls~="${e}"]`).join(", ");return!!r&&e.matches(r)}return!1}(t.target,o,l))return!1;let s="function"==typeof a?a(t):a;return s&&(c.current="click"===t.type),s}})}),o4=aZ(nJ(function(e){return nQ("div",o6(e))}),iO);(0,o.createContext)(null),(0,o.createContext)(null);var o7=nX([n$],[n0]),le=o7.useContext;o7.useScopedContext,o7.useProviderContext,o7.ContextProvider,o7.ScopedContextProvider;var lt={id:null};function lr(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function ln(e,t){return e.filter(e=>e.rowId===t)}function li(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function la(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var lo=ng()&&np();function ll({tag:e,...t}={}){let r=iY(t.store,function(e,...t){if(e)return iN(e,"pick")(...t)}(e,["value","rtl"]));iz(t,r);let n=null==e?void 0:e.getState(),i=null==r?void 0:r.getState(),a=nm(t.activeId,null==i?void 0:i.activeId,t.defaultActiveId,null),o=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),n=function(e={}){var t,r;iz(e,e.store);let n=null==(t=e.store)?void 0:t.getState(),i=nm(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:nm(null==n?void 0:n.renderedItems,[])},l=null==(r=e.store)?void 0:r.__unstablePrivateStore,s=iJ({items:i,renderedItems:o.renderedItems},l),u=iJ(o,e.store),c=e=>{var t;let r,n,i=(t=e=>e.element,r=e.map((e,t)=>[t,e]),n=!1,(r.sort(([e,r],[i,a])=>{var o;let l=t(r),s=t(a);return l!==s&&l&&s?(o=l,s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)?(e>i&&(n=!0),-1):(et):e);s.setState("renderedItems",i),u.setState("renderedItems",i)};iK(u,()=>iQ(s)),iK(s,()=>iq(s,["items"],e=>{u.setState("items",e.items)})),iK(s,()=>iq(s,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return rZ(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=(e,t,r=!1)=>{let n;return t(t=>{let r=t.findIndex(({id:t})=>t===e.id),i=t.slice();if(-1!==r){let o={...n=t[r],...e};i[r]=o,a.set(e.id,o)}else i.push(e),a.set(e.id,e);return i}),()=>{t(t=>{if(!n)return r&&a.delete(e.id),t.filter(({id:t})=>t!==e.id);let i=t.findIndex(({id:t})=>t===e.id);if(-1===i)return t;let o=t.slice();return o[i]=n,a.set(e.id,n),o})}},f=e=>d(e,e=>s.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>nl(f(e),d(e,e=>s.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=s.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:s}}(e),i=nm(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=iJ({...n.getState(),id:nm(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:nm(null==r?void 0:r.baseElement,null),includesBaseElement:nm(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:nm(null==r?void 0:r.moves,0),orientation:nm(e.orientation,null==r?void 0:r.orientation,"both"),rtl:nm(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:nm(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:nm(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:nm(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:nm(e.focusShift,null==r?void 0:r.focusShift,!1)},n,e.store);iK(a,()=>iX(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=lr(e.renderedItems))?void 0:r.id})}));let o=(e="next",t={})=>{var r,n;let i=a.getState(),{skip:o=0,activeId:l=i.activeId,focusShift:s=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:m=i.rtl}=t,h="up"===e||"down"===e,p="next"===e||"down"===e,A=h?iA(function(e,t,r){let n=la(e);for(let i of e)for(let e=0;ee.id===l);if(!g)return null==(n=lr(A))?void 0:n.id;let v=A.some(e=>e.rowId),B=A.indexOf(g),C=A.slice(B+1),y=ln(C,g.rowId);if(o){let e=y.filter(e=>l?!e.disabled&&e.id!==l:!e.disabled),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}let b=u&&(h?"horizontal"!==u:"vertical"!==u),x=v&&c&&(h?"horizontal"!==c:"vertical"!==c),E=p?(!v||h)&&b&&d:!!h&&d;if(b){let e=lr(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[lt]:[],...e.slice(0,n)]}(x&&!E?A:ln(A,g.rowId),l,E),l);return null==e?void 0:e.id}if(x){let e=lr(E?y:C,l);return E?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let M=lr(y,l);return!M&&E?null:null==M?void 0:M.id};return{...n,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=lr(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=lr(ig(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:a,includesBaseElement:nm(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:nm(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:nm(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:nm(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:nm(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),l=function({popover:e,...t}={}){let r=iY(t.store,iW(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));iz(t,r);let n=null==r?void 0:r.getState(),i=aq({...t,store:r}),a=nm(t.placement,null==n?void 0:n.placement,"bottom"),o=iJ({...i.getState(),placement:a,currentPlacement:a,anchorElement:nm(null==n?void 0:n.anchorElement,null),popoverElement:nm(null==n?void 0:n.popoverElement,null),arrowElement:nm(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:nm(t.placement,null==i?void 0:i.placement,"bottom-start")}),s=nm(t.value,null==i?void 0:i.value,t.defaultValue,""),u=nm(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...l.getState(),value:s,selectedValue:u,resetValueOnSelect:nm(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:nm(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=iJ(d,o,l,r);return lo&&iK(f,()=>iX(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),iK(f,()=>{if(e)return nl(iX(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),iX(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),iK(f,()=>iX(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",s)})),iK(f,()=>iX(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),iK(f,()=>iX(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),iK(f,()=>iq(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=o.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...l,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function ls(e={}){var t,r,n,i,a,o,l,s;let u;t=e,u=le();let[c,d]=ai(ll,e={id:nD((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return nI(d,[(n=e).tag]),an(c,n,"value","setValue"),an(c,n,"selectedValue","setSelectedValue"),an(c,n,"resetValueOnHide"),an(c,n,"resetValueOnSelect"),Object.assign((o=c,nI(l=d,[(s=n).popover]),an(o,s,"placement"),i=aQ(o,l,s),a=i,nI(d,[n.store]),an(a,n,"items","setItems"),an(i=a,n,"activeId","setActiveId"),an(i,n,"includesBaseElement"),an(i,n,"virtualFocus"),an(i,n,"orientation"),an(i,n,"rtl"),an(i,n,"focusLoop"),an(i,n,"focusWrap"),an(i,n,"focusShift"),i),{tag:n.tag})}function lu(e={}){let t=ls(e);return(0,i.jsx)(ik,{value:t,children:e.children})}var lc=(0,o.createContext)(void 0),ld=nV(function(e){let[t,r]=(0,o.useState)();return nf(e={role:"group","aria-labelledby":t,...e=n_(e,e=>(0,i.jsx)(lc.Provider,{value:r,children:e}),[])})});nJ(function(e){return nQ("div",ld(e))});var lf=nV(function({store:e,...t}){return ld(t)});nJ(function(e){return nQ("div",lf(e))});var lm=nV(function({store:e,...t}){let r=iP();return nu(e=e||r,!1),"grid"===r7(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=lf({store:e,...t})}),lh=nJ(function(e){return nQ("div",lm(e))}),lp=nV(function(e){let t=(0,o.useContext)(lc),r=nD(e.id);return nT(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),nf(e={id:r,"aria-hidden":!0,...e})});nJ(function(e){return nQ("div",lp(e))});var lA=nV(function({store:e,...t}){return lp(t)});nJ(function(e){return nQ("div",lA(e))});var lg=nV(function(e){return lA(e)}),lv=nJ(function(e){return nQ("div",lg(e))}),lB=e.i(38360);let lC={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},ly=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function lb(e,t,r={}){let{keys:n,threshold:i=lC.MATCHES,baseSort:a=ly,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return n!==a?n>a?-1:1:i===o?r(e,t):i{let l=lx(i,u,c),s=t,{minRanking:d,maxRanking:f,threshold:m}=a;return l=lC.MATCHES?l=d:l>f&&(l=f),l>e&&(e=l,r=o,n=m,s=i),{rankedValue:s,rank:e,keyIndex:r,keyThreshold:n}},{rankedValue:l,rank:lC.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:l,rank:lx(l,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:m=i}=d;return f>=m&&e.push({...d,item:a,index:o}),e},[])).map(({item:e})=>e)}function lx(e,t,r){if(e=lE(e,r),(t=lE(t,r)).length>e.length)return lC.NO_MATCH;if(e===t)return lC.CASE_SENSITIVE_EQUAL;let n=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),i=n.next(),a=i.value;if(e.length===t.length&&0===a)return lC.EQUAL;if(0===a)return lC.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return lC.WORD_STARTS_WITH;o=n.next()}return a>0?lC.CONTAINS:1===t.length?lC.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n-1))return lC.NO_MATCH;return r=a-l,n=i/t.length,lC.MATCHES+1/r*n}(e,t)}function lE(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,lB.default)(e)),e}lb.rankings=lC;let lM={maxRanking:1/0,minRanking:-1/0};var lS=e.i(29402);let lF=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),lT={"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)"},lR={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},lw=(0,t9.getMissionList)().filter(e=>!lF.has(e)).map(e=>{let t,r=(0,t9.getMissionInfo)(e),[n]=(0,t9.getSourceAndPath)(r.resourcePath),i=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",a=lT[n]??lR[i]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:a,missionTypes:r.missionTypes}}),lD=new Map(lw.map(e=>[e.missionName,e])),lI=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,lS.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,lS.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(lw),lG="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function lL(e){let t,r,n,o,l,s=(0,a.c)(12),{mission:u}=e,c=u.displayName||u.missionName;return s[0]!==c?(t=(0,i.jsx)("span",{className:"MissionSelect-itemName",children:c}),s[0]=c,s[1]=t):t=s[1],s[2]!==u.missionTypes?(r=u.missionTypes.length>0&&(0,i.jsx)("span",{className:"MissionSelect-itemTypes",children:u.missionTypes.map(l_)}),s[2]=u.missionTypes,s[3]=r):r=s[3],s[4]!==t||s[5]!==r?(n=(0,i.jsxs)("span",{className:"MissionSelect-itemHeader",children:[t,r]}),s[4]=t,s[5]=r,s[6]=n):n=s[6],s[7]!==u.missionName?(o=(0,i.jsx)("span",{className:"MissionSelect-itemMissionName",children:u.missionName}),s[7]=u.missionName,s[8]=o):o=s[8],s[9]!==n||s[10]!==o?(l=(0,i.jsxs)(i.Fragment,{children:[n,o]}),s[9]=n,s[10]=o,s[11]=l):l=s[11],l}function l_(e){return(0,i.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e)}function lP(e){let t,r,n,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y=(0,a.c)(43),{value:b,missionType:x,onChange:E}=e,[M,S]=(0,o.useState)(""),F=(0,o.useRef)(null),T=(0,o.useRef)(x);y[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,o.startTransition)(()=>S(e))},y[0]=t):t=y[0];let R=ls({resetValueOnHide:!0,selectedValue:b,setSelectedValue:e=>{if(e){let t=T.current,r=(0,t9.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),E({missionName:e,missionType:t}),F.current?.blur()}},setValue:t});y[1]!==R?(r=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),F.current?.focus(),R.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},n=[R],y[1]=R,y[2]=r,y[3]=n):(r=y[2],n=y[3]),(0,o.useEffect)(r,n),y[4]!==b?(l=lD.get(b),y[4]=b,y[5]=l):l=y[5];let w=l;e:{let e,t;if(!M){let e;y[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:lI},y[6]=e):e=y[6],s=e;break e}y[7]!==M?(e=lb(lw,M,{keys:["displayName","missionName","missionTypes","groupName"]}),y[7]=M,y[8]=e):e=y[8];let r=e;y[9]!==r?(t={type:"flat",missions:r},y[9]=r,y[10]=t):t=y[10],s=t}let D=s,I=w?w.displayName||w.missionName:b,G="flat"===D.type?0===D.missions.length:0===D.groups.length,L=e=>(0,i.jsx)(as,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(T.current=r,e.missionName===b&&E({missionName:e.missionName,missionType:r})):T.current=null}else T.current=null},children:(0,i.jsx)(lL,{mission:e})},e.missionName);y[11]!==R?(u=()=>{try{document.exitPointerLock()}catch{}R.show()},c=e=>{"Escape"!==e.key||R.getState().open||F.current?.blur()},y[11]=R,y[12]=u,y[13]=c):(u=y[12],c=y[13]),y[14]!==I||y[15]!==u||y[16]!==c?(d=(0,i.jsx)(i1,{ref:F,autoSelect:!0,placeholder:I,className:"MissionSelect-input",onFocus:u,onKeyDown:c}),y[14]=I,y[15]=u,y[16]=c,y[17]=d):d=y[17],y[18]!==I?(f=(0,i.jsx)("span",{className:"MissionSelect-selectedName",children:I}),y[18]=I,y[19]=f):f=y[19],y[20]!==x?(m=x&&(0,i.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":x,children:x}),y[20]=x,y[21]=m):m=y[21],y[22]!==m||y[23]!==f?(h=(0,i.jsxs)("div",{className:"MissionSelect-selectedValue",children:[f,m]}),y[22]=m,y[23]=f,y[24]=h):h=y[24],y[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,i.jsx)("kbd",{className:"MissionSelect-shortcut",children:lG?"⌘K":"^K"}),y[25]=p):p=y[25],y[26]!==h||y[27]!==d?(A=(0,i.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[d,h,p]}),y[26]=h,y[27]=d,y[28]=A):A=y[28];let _="flat"===D.type?D.missions.map(L):D.groups.map(e=>{let[t,r]=e;return t?(0,i.jsxs)(lh,{className:"MissionSelect-group",children:[(0,i.jsx)(lv,{className:"MissionSelect-groupLabel",children:t}),r.map(L)]},t):(0,i.jsx)(o.Fragment,{children:r.map(L)},"ungrouped")});return y[29]!==G?(g=G&&(0,i.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"}),y[29]=G,y[30]=g):g=y[30],y[31]!==aA||y[32]!==_||y[33]!==g?(v=(0,i.jsxs)(aA,{className:"MissionSelect-list",children:[_,g]}),y[31]=aA,y[32]=_,y[33]=g,y[34]=v):v=y[34],y[35]!==o4||y[36]!==v?(B=(0,i.jsx)(o4,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:"MissionSelect-popover",children:v}),y[35]=o4,y[36]=v,y[37]=B):B=y[37],y[38]!==lu||y[39]!==R||y[40]!==A||y[41]!==B?(C=(0,i.jsxs)(lu,{store:R,children:[A,B]}),y[38]=lu,y[39]=R,y[40]=A,y[41]=B,y[42]=C):C=y[42],C}var lO=e.i(11152),lk=e.i(40141);function lH(e){return(0,lk.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 lj(e){let t,r,n,l,s,u=(0,a.c)(11),{cameraRef:c,missionName:d,missionType:f}=e,{fogEnabled:m}=(0,S.useSettings)(),[h,p]=(0,o.useState)(!1),A=(0,o.useRef)(null);u[0]!==c||u[1]!==m||u[2]!==d||u[3]!==f?(t=async()=>{clearTimeout(A.current);let e=c.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)}`,i=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${i}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${f}`),r.set("fog",m.toString());let n=`${window.location.pathname}?${r}${t}`,i=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(i),p(!0),A.current=setTimeout(()=>{p(!1)},1100)}catch(e){console.error(e)}},u[0]=c,u[1]=m,u[2]=d,u[3]=f,u[4]=t):t=u[4];let g=t,v=h?"true":"false";return u[5]===Symbol.for("react.memo_cache_sentinel")?(r=(0,i.jsx)(lO.FaMapPin,{className:"MapPin"}),n=(0,i.jsx)(lH,{className:"ClipboardCheck"}),l=(0,i.jsx)("span",{className:"ButtonLabel",children:" Copy coordinates URL"}),u[5]=r,u[6]=n,u[7]=l):(r=u[5],n=u[6],l=u[7]),u[8]!==g||u[9]!==v?(s=(0,i.jsxs)("button",{type:"button",className:"IconButton LabelledButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:g,"data-copied":v,id:"copyCoordinatesButton",children:[r,n,l]}),u[8]=g,u[9]=v,u[10]=s):s=u[10],s}function lU(e){return(0,lk.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}function lN(e){return(0,lk.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(e)}function lJ(e){let t,r,n,l,s,u,c,d,f,m,h,p,A,g,v,B,C,y,b,x,E,M,F,T,R,w,D,I,G,L,_,P,O,k,H,j,U,N,J,K,Q,V,X,q,W=(0,a.c)(99),{missionName:Y,missionType:z,onChangeMission:Z,onOpenMapInfo:$,cameraRef:ee,isTouch:et}=e,{fogEnabled:er,setFogEnabled:en,fov:ei,setFov:ea,audioEnabled:eo,setAudioEnabled:el,animationEnabled:es,setAnimationEnabled:eu}=(0,S.useSettings)(),{speedMultiplier:ec,setSpeedMultiplier:ed,touchMode:ef,setTouchMode:em}=(0,S.useControls)(),{debugMode:eh,setDebugMode:ep}=(0,S.useDebug)(),[eA,eg]=(0,o.useState)(!1),ev=(0,o.useRef)(null),eB=(0,o.useRef)(null),eC=(0,o.useRef)(null);W[0]!==eA?(t=()=>{eA&&ev.current?.focus()},r=[eA],W[0]=eA,W[1]=t,W[2]=r):(t=W[1],r=W[2]),(0,o.useEffect)(t,r),W[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{let t=e.relatedTarget;t&&eC.current?.contains(t)||eg(!1)},W[3]=n):n=W[3];let ey=n;W[4]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{"Escape"===e.key&&(eg(!1),eB.current?.focus())},W[4]=l):l=W[4];let eb=l;return W[5]!==Y||W[6]!==z||W[7]!==Z?(s=(0,i.jsx)(lP,{value:Y,missionType:z,onChange:Z}),W[5]=Y,W[6]=z,W[7]=Z,W[8]=s):s=W[8],W[9]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{eg(lK)},W[9]=u):u=W[9],W[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)(lN,{}),W[10]=c):c=W[10],W[11]!==eA?(d=(0,i.jsx)("button",{ref:eB,className:"IconButton Controls-toggle",onClick:u,"aria-expanded":eA,"aria-controls":"settingsPanel","aria-label":"Settings",children:c}),W[11]=eA,W[12]=d):d=W[12],W[13]!==ee||W[14]!==Y||W[15]!==z?(f=(0,i.jsx)(lj,{cameraRef:ee,missionName:Y,missionType:z}),W[13]=ee,W[14]=Y,W[15]=z,W[16]=f):f=W[16],W[17]===Symbol.for("react.memo_cache_sentinel")?(m=(0,i.jsx)(lU,{}),h=(0,i.jsx)("span",{className:"ButtonLabel",children:"Show map info"}),W[17]=m,W[18]=h):(m=W[17],h=W[18]),W[19]!==$?(p=(0,i.jsxs)("button",{type:"button",className:"IconButton LabelledButton MapInfoButton","aria-label":"Show map info",onClick:$,children:[m,h]}),W[19]=$,W[20]=p):p=W[20],W[21]!==p||W[22]!==f?(A=(0,i.jsxs)("div",{className:"Controls-group",children:[f,p]}),W[21]=p,W[22]=f,W[23]=A):A=W[23],W[24]!==en?(g=e=>{en(e.target.checked)},W[24]=en,W[25]=g):g=W[25],W[26]!==er||W[27]!==g?(v=(0,i.jsx)("input",{id:"fogInput",type:"checkbox",checked:er,onChange:g}),W[26]=er,W[27]=g,W[28]=v):v=W[28],W[29]===Symbol.for("react.memo_cache_sentinel")?(B=(0,i.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),W[29]=B):B=W[29],W[30]!==v?(C=(0,i.jsxs)("div",{className:"CheckboxField",children:[v,B]}),W[30]=v,W[31]=C):C=W[31],W[32]!==el?(y=e=>{el(e.target.checked)},W[32]=el,W[33]=y):y=W[33],W[34]!==eo||W[35]!==y?(b=(0,i.jsx)("input",{id:"audioInput",type:"checkbox",checked:eo,onChange:y}),W[34]=eo,W[35]=y,W[36]=b):b=W[36],W[37]===Symbol.for("react.memo_cache_sentinel")?(x=(0,i.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),W[37]=x):x=W[37],W[38]!==b?(E=(0,i.jsxs)("div",{className:"CheckboxField",children:[b,x]}),W[38]=b,W[39]=E):E=W[39],W[40]!==C||W[41]!==E?(M=(0,i.jsxs)("div",{className:"Controls-group",children:[C,E]}),W[40]=C,W[41]=E,W[42]=M):M=W[42],W[43]!==eu?(F=e=>{eu(e.target.checked)},W[43]=eu,W[44]=F):F=W[44],W[45]!==es||W[46]!==F?(T=(0,i.jsx)("input",{id:"animationInput",type:"checkbox",checked:es,onChange:F}),W[45]=es,W[46]=F,W[47]=T):T=W[47],W[48]===Symbol.for("react.memo_cache_sentinel")?(R=(0,i.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),W[48]=R):R=W[48],W[49]!==T?(w=(0,i.jsxs)("div",{className:"CheckboxField",children:[T,R]}),W[49]=T,W[50]=w):w=W[50],W[51]!==ep?(D=e=>{ep(e.target.checked)},W[51]=ep,W[52]=D):D=W[52],W[53]!==eh||W[54]!==D?(I=(0,i.jsx)("input",{id:"debugInput",type:"checkbox",checked:eh,onChange:D}),W[53]=eh,W[54]=D,W[55]=I):I=W[55],W[56]===Symbol.for("react.memo_cache_sentinel")?(G=(0,i.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),W[56]=G):G=W[56],W[57]!==I?(L=(0,i.jsxs)("div",{className:"CheckboxField",children:[I,G]}),W[57]=I,W[58]=L):L=W[58],W[59]!==w||W[60]!==L?(_=(0,i.jsxs)("div",{className:"Controls-group",children:[w,L]}),W[59]=w,W[60]=L,W[61]=_):_=W[61],W[62]===Symbol.for("react.memo_cache_sentinel")?(P=(0,i.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),W[62]=P):P=W[62],W[63]!==ea?(O=e=>ea(parseInt(e.target.value)),W[63]=ea,W[64]=O):O=W[64],W[65]!==ei||W[66]!==O?(k=(0,i.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:ei,onChange:O}),W[65]=ei,W[66]=O,W[67]=k):k=W[67],W[68]!==ei?(H=(0,i.jsx)("output",{htmlFor:"fovInput",children:ei}),W[68]=ei,W[69]=H):H=W[69],W[70]!==k||W[71]!==H?(j=(0,i.jsxs)("div",{className:"Field",children:[P,k,H]}),W[70]=k,W[71]=H,W[72]=j):j=W[72],W[73]===Symbol.for("react.memo_cache_sentinel")?(U=(0,i.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),W[73]=U):U=W[73],W[74]!==ed?(N=e=>ed(parseFloat(e.target.value)),W[74]=ed,W[75]=N):N=W[75],W[76]!==ec||W[77]!==N?(J=(0,i.jsxs)("div",{className:"Field",children:[U,(0,i.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:ec,onChange:N})]}),W[76]=ec,W[77]=N,W[78]=J):J=W[78],W[79]!==j||W[80]!==J?(K=(0,i.jsxs)("div",{className:"Controls-group",children:[j,J]}),W[79]=j,W[80]=J,W[81]=K):K=W[81],W[82]!==et||W[83]!==em||W[84]!==ef?(Q=et&&(0,i.jsx)("div",{className:"Controls-group",children:(0,i.jsxs)("div",{className:"Field",children:[(0,i.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick:"})," ",(0,i.jsxs)("select",{id:"touchModeInput",value:ef,onChange:e=>em(e.target.value),children:[(0,i.jsx)("option",{value:"dualStick",children:"Dual Stick"}),(0,i.jsx)("option",{value:"moveLookStick",children:"Single Stick"})]})]})}),W[82]=et,W[83]=em,W[84]=ef,W[85]=Q):Q=W[85],W[86]!==eA||W[87]!==A||W[88]!==M||W[89]!==_||W[90]!==K||W[91]!==Q?(V=(0,i.jsxs)("div",{className:"Controls-dropdown",ref:ev,id:"settingsPanel",tabIndex:-1,onKeyDown:eb,onBlur:ey,"data-open":eA,children:[A,M,_,K,Q]}),W[86]=eA,W[87]=A,W[88]=M,W[89]=_,W[90]=K,W[91]=Q,W[92]=V):V=W[92],W[93]!==V||W[94]!==d?(X=(0,i.jsxs)("div",{ref:eC,children:[d,V]}),W[93]=V,W[94]=d,W[95]=X):X=W[95],W[96]!==X||W[97]!==s?(q=(0,i.jsxs)("div",{id:"controls",onKeyDown:lX,onPointerDown:lV,onClick:lQ,children:[s,X]}),W[96]=X,W[97]=s,W[98]=q):q=W[98],q}function lK(e){return!e}function lQ(e){return e.stopPropagation()}function lV(e){return e.stopPropagation()}function lX(e){return e.stopPropagation()}let lq=()=>null,lW=o.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:i,...a},l)=>{let s=(0,C.useThree)(({set:e})=>e),c=(0,C.useThree)(({camera:e})=>e),d=(0,C.useThree)(({size:e})=>e),f=o.useRef(null);o.useImperativeHandle(l,()=>f.current,[]);let m=o.useRef(null),h=function(e,t,r){let n=(0,C.useThree)(e=>e.size),i=(0,C.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,l=n.height*i.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:d,...f}=s,m=null!=d?d:s.depthBuffer,h=o.useMemo(()=>{let e=new u.WebGLRenderTarget(a,l,{minFilter:u.LinearFilter,magFilter:u.LinearFilter,type:u.HalfFloatType,...f});return m&&(e.depthTexture=new u.DepthTexture(a,l,u.FloatType)),e.samples=c,e},[]);return o.useLayoutEffect(()=>{h.setSize(a,l),c&&(h.samples=c)},[c,h,a,l]),o.useEffect(()=>()=>h.dispose(),[]),h}(t);o.useLayoutEffect(()=>{a.manual||(f.current.aspect=d.width/d.height)},[d,a]),o.useLayoutEffect(()=>{f.current.updateProjectionMatrix()});let p=0,A=null,g="function"==typeof i;return(0,B.useFrame)(t=>{g&&(r===1/0||p{if(n)return s(()=>({camera:f.current})),()=>s(()=>({camera:c}))},[f,n,s]),o.createElement(o.Fragment,null,o.createElement("perspectiveCamera",(0,W.default)({ref:f},a),!g&&i),o.createElement("group",{ref:m},g&&i(h.texture)))});function lY(){let e,t,r=(0,a.c)(3),{fov:n}=(0,S.useSettings)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],r[0]=e):e=r[0],r[1]!==n?(t=(0,i.jsx)(lW,{makeDefault:!0,position:e,fov:n}),r[1]=n,r[2]=t):t=r[2],t}var lz=e.i(51434),lZ=e.i(81405);function l$(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function l0({showPanel:e=0,className:t,parent:r}){let n=function(e,t=[],r){let[n,i]=o.useState();return o.useLayoutEffect(()=>{let t=e();return i(t),l$(void 0,t),()=>l$(void 0,null)},t),n}(()=>new lZ.default,[]);return o.useEffect(()=>{if(n){let i=r&&r.current||document.body;n.showPanel(e),null==i||i.appendChild(n.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&n.dom.classList.add(...a);let o=(0,l.j)(()=>n.begin()),s=(0,l.k)(()=>n.end());return()=>{a.length&&n.dom.classList.remove(...a),null==i||i.removeChild(n.dom),o(),s()}}},[r,n,t,e]),null}var l1=e.i(60099);function l2(){let e,t,r=(0,a.c)(3),{debugMode:n}=(0,S.useDebug)(),l=(0,o.useRef)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=l.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},r[0]=e):e=r[0],(0,o.useEffect)(e),r[1]!==n?(t=n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l0,{className:"StatsPanel"}),(0,i.jsx)("axesHelper",{ref:l,args:[70],renderOrder:999,children:(0,i.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,i.jsx)(l1.Html,{position:[80,0,0],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,i.jsx)(l1.Html,{position:[0,80,0],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,i.jsx)(l1.Html,{position:[0,0,80],center:!0,children:(0,i.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null,r[1]=n,r[2]=t):t=r[2],t}var l9=e.i(50361),l3=e.i(24540);function l5(e,t,r){try{return e(t)}catch(e){return(0,l3.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function l8(e){function t(t){if(void 0===t)return null;let r="";if(Array.isArray(t)){if(void 0===t[0])return null;r=t[0]}return"string"==typeof t&&(r=t),l5(e.parse,r)}return{type:"single",eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:r=>t(r)??e}},withOptions(e){return{...this,...e}}}}l8({parse:e=>e,serialize:String}),l8({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),l8({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),l8({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(1&t.length?"0":"")+t}}),l8({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String});let l6=l8({parse:e=>"true"===e.toLowerCase(),serialize:String});function l4(e,t){return e.valueOf()===t.valueOf()}l8({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:l4}),l8({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:l4}),l8({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:l4});let l7=(0,l9.r)(),se={};function st(e,t,r,n,i,a){let o=!1,l=Object.entries(e).reduce((e,[l,s])=>{var u;let c=t?.[l]??l,d=n[c],f="multi"===s.type?[]:null,m=void 0===d?("multi"===s.type?r?.getAll(c):r?.get(c))??f:d;return i&&a&&((u=i[c]??f)===m||null!==u&&null!==m&&"string"!=typeof u&&"string"!=typeof m&&u.length===m.length&&u.every((e,t)=>e===m[t]))?e[l]=a[l]??null:(o=!0,e[l]=((0,l9.i)(m)?null:l5(s.parse,m,c))??null,i&&(i[c]=m)),e},{});if(!o){let t=Object.keys(e),r=Object.keys(a??{});o=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:l,hasChanged:o}}function sr(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}function sn(e,t={}){let{parse:r,type:n,serialize:i,eq:a,defaultValue:l,...s}=t,[{[e]:u},c]=function(e,t={}){let r=(0,o.useId)(),n=(0,l3.i)(),i=(0,l3.a)(),{history:a="replace",scroll:l=n?.scroll??!1,shallow:s=n?.shallow??!0,throttleMs:u=l9.s.timeMs,limitUrlUpdates:c=n?.limitUrlUpdates,clearOnDefault:d=n?.clearOnDefault??!0,startTransition:f,urlKeys:m=se}=t,h=Object.keys(e).join(","),p=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,m[e]??e])),[h,JSON.stringify(m)]),A=(0,l3.r)(Object.values(p)),g=A.searchParams,v=(0,o.useRef)({}),B=(0,o.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),C=l9.t.useQueuedQueries(Object.values(p)),[y,b]=(0,o.useState)(()=>st(e,m,g??new URLSearchParams,C).state),x=(0,o.useRef)(y);if((0,l3.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,h,y,g),Object.keys(v.current).join("&")!==Object.values(p).join("&")){let{state:t,hasChanged:n}=st(e,m,g,C,v.current,x.current);n&&((0,l3.c)("[nuq+ %s `%s`] State changed: %O",r,h,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t)),v.current=Object.fromEntries(Object.entries(p).map(([t,r])=>[r,e[t]?.type==="multi"?g?.getAll(r):g?.get(r)??null]))}(0,o.useEffect)(()=>{let{state:t,hasChanged:n}=st(e,m,g,C,v.current,x.current);n&&((0,l3.c)("[nuq+ %s `%s`] State changed: %O",r,h,{state:t,initialSearchParams:g,queuedQueries:C,queryRef:v.current,stateRef:x.current}),x.current=t,b(t))},[Object.values(p).map(e=>`${e}=${g?.getAll(e)}`).join("&"),JSON.stringify(C)]),(0,o.useEffect)(()=>{let t=Object.keys(e).reduce((t,n)=>(t[n]=({state:t,query:i})=>{b(a=>{let{defaultValue:o}=e[n],l=p[n],s=t??o??null;return Object.is(a[n]??o??null,s)?((0,l3.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,h,l,t,o,x.current),a):(x.current={...x.current,[n]:s},v.current[l]=i,(0,l3.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,h,l,t,o,x.current),x.current)})},t),{});for(let n of Object.keys(e)){let e=p[n];(0,l3.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,h),l7.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=p[n];(0,l3.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,h),l7.off(e,t[n])}}},[h,p]);let E=(0,o.useCallback)((t,n={})=>{let o,m=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g="function"==typeof t?t(sr(x.current,B))??m:t??m;(0,l3.c)("[nuq+ %s `%s`] setState: %O",r,h,g);let v=0,C=!1,y=[];for(let[t,r]of Object.entries(g)){let m=e[t],h=p[t];if(!m||void 0===r)continue;(n.clearOnDefault??m.clearOnDefault??d)&&null!==r&&void 0!==m.defaultValue&&(m.eq??((e,t)=>e===t))(r,m.defaultValue)&&(r=null);let g=null===r?null:(m.serialize??String)(r);l7.emit(h,{state:r,query:g});let B={key:h,query:g,options:{history:n.history??m.history??a,shallow:n.shallow??m.shallow??s,scroll:n.scroll??m.scroll??l,startTransition:n.startTransition??m.startTransition??f}};if(n?.limitUrlUpdates?.method==="debounce"||c?.method==="debounce"||m.limitUrlUpdates?.method==="debounce"){!0===B.options.shallow&&console.warn((0,l3.s)(422));let e=n?.limitUrlUpdates?.timeMs??c?.timeMs??m.limitUrlUpdates?.timeMs??l9.s.timeMs,t=l9.t.push(B,e,A,i);vt(e),C?l9.n.flush(A,i):l9.n.getPendingPromise(A));return o??b},[h,a,s,l,u,c?.method,c?.timeMs,f,p,A.updateUrl,A.getSearchParamsSnapshot,A.rateLimitFactor,i,B]);return[(0,o.useMemo)(()=>sr(y,B),[y,B]),E]}({[e]:{parse:r??(e=>e),type:n,serialize:i,eq:a,defaultValue:l}},s);return[u,(0,o.useCallback)((t,r={})=>c(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,c])]}let si=(0,o.lazy)(()=>e.A(59197).then(e=>({default:e.MapInfoDialog}))),sa=new rm,so={toneMapping:u.NoToneMapping,outputColorSpace:u.SRGBColorSpace},sl=l8({parse(e){let[t,r]=e.split("~"),n=r,i=(0,t9.getMissionInfo)(t).missionTypes;return r&&i.includes(r)||(n=i[0]),{missionName:t,missionType:n}},serialize:({missionName:e,missionType:t})=>1===(0,t9.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function ss(){let e,t,r,n,l,s,c,d,f,m,h,A,g,v,B,C,y,b,x,E,M,F,T,R,w,D,I,G,L,_,P,O,k,H=(0,a.c)(60),[j,U]=sn("mission",sl),[N,J]=sn("fog",l6);H[0]!==J?(e=()=>{J(null)},H[0]=J,H[1]=e):e=H[1];let K=e;H[2]!==K||H[3]!==U?(t=e=>{window.location.hash="",K(),U(e)},H[2]=K,H[3]=U,H[4]=t):t=H[4];let Q=t,V=(_=(0,a.c)(2),P=(0,o.useRef)(null),_[0]===Symbol.for("react.memo_cache_sentinel")?(G=e=>{let t=window.matchMedia("(pointer: coarse)");return t.addEventListener("change",e),P.current=t,()=>{t.removeEventListener("change",e)}},_[0]=G):G=_[0],O=G,_[1]===Symbol.for("react.memo_cache_sentinel")?(L=()=>P.current?.matches??null,_[1]=L):L=_[1],k=L,(0,o.useSyncExternalStore)(O,k,lq)),{missionName:X,missionType:q}=j,[W,Y]=(0,o.useState)(!1),[z,Z]=(0,o.useState)(0),[$,ee]=(0,o.useState)(!0),et=z<1;H[5]!==et?(r=()=>{if(et)ee(!0);else{let e=setTimeout(()=>ee(!1),500);return()=>clearTimeout(e)}},n=[et],H[5]=et,H[6]=r,H[7]=n):(r=H[6],n=H[7]),(0,o.useEffect)(r,n),H[8]!==Q?(l=()=>(window.setMissionName=e=>{let t=(0,t9.getMissionInfo)(e).missionTypes;Q({missionName:e,missionType:t[0]})},window.getMissionList=t9.getMissionList,window.getMissionInfo=t9.getMissionInfo,su),s=[Q],H[8]=Q,H[9]=l,H[10]=s):(l=H[9],s=H[10]),(0,o.useEffect)(l,s),H[11]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{let e=e=>{if("KeyI"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||Y(!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},d=[],H[11]=c,H[12]=d):(c=H[11],d=H[12]),(0,o.useEffect)(c,d),H[13]===Symbol.for("react.memo_cache_sentinel")?(f=(e,t)=>{Z(void 0===t?0:t)},H[13]=f):f=H[13];let er=f,en=(0,o.useRef)(null);H[14]===Symbol.for("react.memo_cache_sentinel")?(m={angle:0,force:0},H[14]=m):m=H[14];let ei=(0,o.useRef)(m),ea=(0,o.useRef)(null);H[15]===Symbol.for("react.memo_cache_sentinel")?(h={angle:0,force:0},H[15]=h):h=H[15];let eo=(0,o.useRef)(h),el=(0,o.useRef)(null);H[16]!==et||H[17]!==z||H[18]!==$?(A=$&&(0,i.jsxs)("div",{id:"loadingIndicator","data-complete":!et,children:[(0,i.jsx)("div",{className:"LoadingSpinner"}),(0,i.jsx)("div",{className:"LoadingProgress",children:(0,i.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*z}%`}})}),(0,i.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*z),"%"]})]}),H[16]=et,H[17]=z,H[18]=$,H[19]=A):A=H[19],H[20]===Symbol.for("react.memo_cache_sentinel")?(g={type:u.PCFShadowMap},v=e=>{en.current=e.camera},H[20]=g,H[21]=v):(g=H[20],v=H[21]);let es=`${X}~${q}`;return H[22]!==X||H[23]!==q||H[24]!==es?(B=(0,i.jsx)(t6,{name:X,missionType:q,onLoadingChange:er},es),H[22]=X,H[23]=q,H[24]=es,H[25]=B):B=H[25],H[26]===Symbol.for("react.memo_cache_sentinel")?(C=(0,i.jsx)(lY,{}),y=(0,i.jsx)(l2,{}),H[26]=C,H[27]=y):(C=H[26],y=H[27]),H[28]!==V?(b=null===V?null:V?(0,i.jsx)(rY,{joystickState:ei,joystickZone:ea,lookJoystickState:eo,lookJoystickZone:el}):(0,i.jsx)(rL,{}),H[28]=V,H[29]=b):b=H[29],H[30]!==B||H[31]!==b?(x=(0,i.jsx)(p,{frameloop:"always",gl:so,shadows:g,onCreated:v,children:(0,i.jsx)(tq,{children:(0,i.jsxs)(lz.AudioProvider,{children:[B,C,y,b]})})}),H[30]=B,H[31]=b,H[32]=x):x=H[32],H[33]!==A||H[34]!==x?(E=(0,i.jsxs)("div",{id:"canvasContainer",children:[A,x]}),H[33]=A,H[34]=x,H[35]=E):E=H[35],H[36]!==V?(M=V&&(0,i.jsx)(rW,{joystickState:ei,joystickZone:ea,lookJoystickState:eo,lookJoystickZone:el}),H[36]=V,H[37]=M):M=H[37],H[38]!==V?(F=!1===V&&(0,i.jsx)(rO,{}),H[38]=V,H[39]=F):F=H[39],H[40]===Symbol.for("react.memo_cache_sentinel")?(T=()=>Y(!0),H[40]=T):T=H[40],H[41]!==Q||H[42]!==V||H[43]!==X||H[44]!==q?(R=(0,i.jsx)(lJ,{missionName:X,missionType:q,onChangeMission:Q,onOpenMapInfo:T,cameraRef:en,isTouch:V}),H[41]=Q,H[42]=V,H[43]=X,H[44]=q,H[45]=R):R=H[45],H[46]!==W||H[47]!==X||H[48]!==q?(w=W&&(0,i.jsx)(o.Suspense,{fallback:null,children:(0,i.jsx)(si,{open:W,onClose:()=>Y(!1),missionName:X,missionType:q??""})}),H[46]=W,H[47]=X,H[48]=q,H[49]=w):w=H[49],H[50]!==E||H[51]!==M||H[52]!==F||H[53]!==R||H[54]!==w?(D=(0,i.jsxs)(rv,{map:rG,children:[E,M,F,R,w]}),H[50]=E,H[51]=M,H[52]=F,H[53]=R,H[54]=w,H[55]=D):D=H[55],H[56]!==K||H[57]!==N||H[58]!==D?(I=(0,i.jsx)(rh.QueryClientProvider,{client:sa,children:(0,i.jsx)("main",{children:(0,i.jsx)(S.SettingsProvider,{fogEnabledOverride:N,onClearFogEnabledOverride:K,children:D})})}),H[56]=K,H[57]=N,H[58]=D,H[59]=I):I=H[59],I}function su(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}function sc(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(ss,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>sc],31713)}]); \ No newline at end of file diff --git a/docs/_next/static/chunks/f0f828674b39f3d8.css b/docs/_next/static/chunks/f0f828674b39f3d8.css new file mode 100644 index 00000000..a1f61174 --- /dev/null +++ b/docs/_next/static/chunks/f0f828674b39f3d8.css @@ -0,0 +1 @@ +html{box-sizing:border-box;background:#000;margin:0;padding:0;overflow:hidden}*,:before,:after{box-sizing:inherit}body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-size:100%}body{margin:0;padding:0;overflow:hidden}main{width:100dvw;height:100dvh}#canvasContainer{z-index:0;position:absolute;inset:0}#controls{color:#fff;z-index:2;background:#00000080;border-radius:0 0 4px;padding:8px 12px 8px 8px;font-size:13px;position:fixed;top:0;left:0}input[type=range]{max-width:80px}.CheckboxField,.LabelledButton,.Field{align-items:center;gap:6px;display:flex}#controls,.Controls-dropdown,.Controls-group{justify-content:center;align-items:center;gap:20px;display:flex}@media (max-width:1279px){.Controls-dropdown[data-open=false]{display:none}.Controls-dropdown{background:#000c;border:1px solid #fff3;border-radius:4px;flex-direction:column;align-items:center;gap:12px;max-height:calc(100dvh - 56px);padding:12px;display:flex;position:absolute;top:calc(100% + 2px);left:2px;right:2px;overflow:auto;box-shadow:0 0 12px #0006}.Controls-group{flex-wrap:wrap;gap:12px 20px}}@media (max-width:639px){#controls{border-radius:0;right:0}#controls>.MissionSelect-inputWrapper{flex:1 1 0;min-width:0}#controls>.MissionSelect-inputWrapper .MissionSelect-input{width:100%}.Controls-toggle{flex:none}}.IconButton{color:#fff;cursor:pointer;background:#03529399;border:1px solid #c8c8c84d;border-color:#ffffff4d #c8c8c84d #c8c8c84d #ffffff4d;border-radius:4px;justify-content:center;align-items:center;width:28px;height:28px;margin:0 0 0 -12px;padding:0;font-size:15px;transition:background .2s,border-color .2s;display:flex;position:relative;transform:translate(0);box-shadow:0 1px 2px #0006}.ButtonLabel{font-size:12px}.IconButton svg{pointer-events:none}@media (hover:hover){.IconButton:hover{background:#0062b3cc;border-color:#fff6}}.IconButton:active,.IconButton[aria-expanded=true]{background:#0062b3b3;border-color:#ffffff4d;transform:translateY(1px)}.IconButton[data-active=true]{background:#0075d5e6;border-color:#fff6}.Controls-toggle{margin:0}@media (max-width:1279px){.LabelledButton{width:auto;padding:0 10px}}@media (min-width:1280px){.Controls-toggle,.LabelledButton .ButtonLabel,.MapInfoButton{display:none}}.CopyCoordinatesButton[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton .ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton[data-copied=true] .ClipboardCheck{animation:.22s linear infinite showClipboardCheck;display:block}.CopyCoordinatesButton[data-copied=true] .MapPin{display:none}.StaticShapeLabel{color:#fff;white-space:nowrap;text-align:center;background:#00000080;border-radius:1px;padding:1px 3px;font-size:11px}.PlayerNameplate{pointer-events:none;text-align:center;white-space:nowrap}.PlayerNameplate-name{color:#fff;text-shadow:0 1px 3px #000000e6,0 0 1px #000000b3;font-size:11px}.PlayerNameplate-healthBar{background:#00000080;border:1px solid #fff3;width:60px;height:4px;margin:2px auto 0;overflow:hidden}.PlayerNameplate-healthFill{background:#2ecc40;height:100%}.StatsPanel{bottom:0;right:0;top:auto!important;left:auto!important}.AxisLabel{pointer-events:none;font-size:12px}.AxisLabel[data-axis=x]{color:#f90}.AxisLabel[data-axis=y]{color:#9f0}.AxisLabel[data-axis=z]{color:#09f}.MissionSelect-inputWrapper{align-items:center;display:flex;position:relative}.MissionSelect-shortcut{color:#fff9;pointer-events:none;background:#ffffff26;border-radius:3px;padding:1px 4px;font-family:system-ui,sans-serif;font-size:11px;position:absolute;right:7px}.MissionSelect-input[aria-expanded=true]~.MissionSelect-shortcut{display:none}.MissionSelect-input{color:#fff;-webkit-user-select:text;user-select:text;background:#0009;border:1px solid #ffffff4d;border-radius:3px;outline:none;width:280px;padding:6px 36px 6px 8px;font-size:14px}.MissionSelect-input[aria-expanded=true]{padding-right:8px}.MissionSelect-input:focus{border-color:#fff9}.MissionSelect-input::placeholder{color:#0000}.MissionSelect-selectedValue{pointer-events:none;align-items:center;gap:6px;display:flex;position:absolute;left:8px;right:36px;overflow:hidden}.MissionSelect-input[aria-expanded=true]~.MissionSelect-selectedValue{display:none}.MissionSelect-selectedName{color:#fff;white-space:nowrap;text-overflow:ellipsis;flex-shrink:1;min-width:0;font-size:14px;font-weight:600;overflow:hidden}.MissionSelect-selectedValue>.MissionSelect-itemType{flex-shrink:0}.MissionSelect-popover{z-index:100;min-width:320px;max-height:var(--popover-available-height,90vh);overscroll-behavior:contain;background:#141414f2;border:1px solid #ffffff80;border-radius:3px;overflow-y:auto;box-shadow:0 8px 24px #0009}.MissionSelect-list{padding:4px 0}.MissionSelect-list:has(>.MissionSelect-group:first-child){padding-top:0}.MissionSelect-group{padding-bottom:4px}.MissionSelect-groupLabel{color:#c6caca;z-index:1;background:#3a4548f2;border-bottom:1px solid #ffffff4d;padding:6px 8px 6px 12px;font-size:13px;font-weight:600;position:sticky;top:0}.MissionSelect-group:not(:last-child){border-bottom:1px solid #ffffff4d}.MissionSelect-item{cursor:pointer;border-radius:4px;outline:none;flex-direction:column;gap:1px;margin:4px 4px 0;padding:6px 8px;scroll-margin-top:32px;display:flex}.MissionSelect-list>.MissionSelect-item:first-child{margin-top:0}.MissionSelect-item[data-active-item]{background:#ffffff26}.MissionSelect-item[aria-selected=true]{background:#6496ff4d}.MissionSelect-itemHeader{align-items:center;gap:6px;display:flex}.MissionSelect-itemName{color:#fff;font-size:14px;font-weight:600}.MissionSelect-itemTypes{gap:3px;display:flex}.MissionSelect-itemType{color:#fff;background:#ff9d0066;border-radius:3px;padding:2px 5px;font-size:10px;font-weight:600}.MissionSelect-itemType:hover{background:#ff9d00b3}.MissionSelect-itemMissionName{color:#ffffff80;font-size:12px}.MissionSelect-noResults{color:#ffffff80;text-align:center;padding:12px 8px;font-size:13px}.LoadingSpinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite LoadingSpinner-spin}@keyframes LoadingSpinner-spin{to{transform:rotate(360deg)}}#loadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#loadingIndicator[data-complete=true]{animation:.3s ease-out forwards loadingComplete}@keyframes loadingComplete{0%{opacity:1}to{opacity:0}}.LoadingProgress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.LoadingProgress-bar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.LoadingProgress-text{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes showClipboardCheck{0%{opacity:1}to{opacity:.2}}.KeyboardOverlay{pointer-events:none;z-index:1;align-items:flex-end;gap:10px;display:flex;position:fixed;bottom:16px;left:50%;transform:translate(-50%)}.KeyboardOverlay-column{flex-direction:column;justify-content:center;gap:4px;display:flex}.KeyboardOverlay-row{justify-content:stretch;gap:4px;display:flex}.KeyboardOverlay-spacer{width:32px}.KeyboardOverlay-key{color:#ffffff80;white-space:nowrap;background:#0006;border:1px solid #fff3;border-radius:4px;flex:1 0 0;justify-content:center;align-items:center;min-width:32px;height:32px;padding:0 8px;font-size:11px;font-weight:600;display:flex}.KeyboardOverlay-key[data-pressed=true]{color:#fff;background:#34bbab99;border-color:#23fddc80}.KeyboardOverlay-arrow{margin-right:3px}.TouchJoystick{z-index:1;width:140px;height:140px;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}.TouchJoystick--left{left:20px;transform:none}.TouchJoystick--right{left:auto;right:20px;transform:none}.TouchJoystick .back{background:#034f4c99!important;border:1px solid #00dbdf80!important;box-shadow:inset 0 0 10px #000000b3!important}.TouchJoystick .front{background:radial-gradient(circle,#17f7c6e6 0%,#09b8aaf2 100%)!important;border:2px solid #fff6!important;box-shadow:0 2px 4px #00000080,0 1px 1px #0000004d,inset 0 1px #ffffff26,inset 0 -1px 2px #0000004d!important}.DemoControls{color:#fff;z-index:2;background:#000000b3;align-items:center;gap:10px;padding:8px 12px;font-size:13px;display:flex;position:fixed;bottom:0;left:0;right:0}.DemoControls-playPause{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;padding:0;font-size:14px;display:flex}@media (hover:hover){.DemoControls-playPause:hover{background:#0062b3cc}}.DemoControls-time{font-variant-numeric:tabular-nums;white-space:nowrap;flex-shrink:0}.DemoControls-seek[type=range]{flex:1 1 0;min-width:0;max-width:none}.DemoControls-speed{color:#fff;background:#0009;border:1px solid #ffffff4d;border-radius:3px;flex-shrink:0;padding:2px 4px;font-size:12px}.DemoDiagnosticsPanel{background:#0000008c;border:1px solid #fff3;border-radius:4px;flex-direction:column;gap:3px;min-width:320px;margin-left:8px;padding:4px 8px;display:flex}.DemoDiagnosticsPanel[data-context-lost=true]{background:#46000073;border-color:#ff5a5acc}.DemoDiagnosticsPanel-status{letter-spacing:.02em;font-size:11px;font-weight:700}.DemoDiagnosticsPanel-metrics{opacity:.92;flex-wrap:wrap;gap:4px 10px;font-size:11px;display:flex}.DemoDiagnosticsPanel-footer{flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:11px;display:flex}.DemoDiagnosticsPanel-footer button{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:3px;padding:1px 6px;font-size:11px}.DemoDiagnosticsPanel-footer button:hover{background:#0062b3cc}.DemoIcon{font-size:19px} diff --git a/docs/_not-found/__next._full.txt b/docs/_not-found/__next._full.txt index c6f69fec..b1cb368e 100644 --- a/docs/_not-found/__next._full.txt +++ b/docs/_not-found/__next._full.txt @@ -7,8 +7,8 @@ 8:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] a:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] c:I[68027,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"P":null,"b":"-NrDAGL0vu_8RrgSU0FFY","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/284925ee1f24c201.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +0:{"P":null,"b":"TA1NEd7uhnyFsTRk4wMjb","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/f0f828674b39f3d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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/4fd93823156e59e8.js"],"IconMark"] 7:null diff --git a/docs/_not-found/__next._head.txt b/docs/_not-found/__next._head.txt index e04cbb69..00d14d7b 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/4fd93823156e59e8.js"],"MetadataBoundary"] 4:"$Sreact.suspense" 5:I[27201,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"IconMark"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","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":"TA1NEd7uhnyFsTRk4wMjb","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 eca24451..11349f6a 100644 --- a/docs/_not-found/__next._index.txt +++ b/docs/_not-found/__next._index.txt @@ -2,5 +2,5 @@ 2:I[12985,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js"],"NuqsAdapter"] 3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/284925ee1f24c201.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","precedence":"next"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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 b84d612f..cac383db 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/4fd93823156e59e8.js"],"OutletBoundary"] 3:"$Sreact.suspense" -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","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":"TA1NEd7uhnyFsTRk4wMjb","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 1154e0b1..690fc9eb 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/4fd93823156e59e8.js"],"default"] 3:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","rsc":["$","$1","c",{"children":[null,["$","$L2",null,{"parallelRouterKey":"children","template":["$","$L3",null,{}]}]]}],"loading":null,"isPartial":false} +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","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 54243166..556d158f 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/284925ee1f24c201.css","style"] -0:{"buildId":"-NrDAGL0vu_8RrgSU0FFY","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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +0:{"buildId":"TA1NEd7uhnyFsTRk4wMjb","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 5a4babc0..73149611 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 c6f69fec..b1cb368e 100644 --- a/docs/_not-found/index.txt +++ b/docs/_not-found/index.txt @@ -7,8 +7,8 @@ 8:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] a:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] c:I[68027,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"P":null,"b":"-NrDAGL0vu_8RrgSU0FFY","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/284925ee1f24c201.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +0:{"P":null,"b":"TA1NEd7uhnyFsTRk4wMjb","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/f0f828674b39f3d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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/4fd93823156e59e8.js"],"IconMark"] 7:null diff --git a/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb b/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb new file mode 100644 index 00000000..737ef945 Binary files /dev/null and b/docs/base/@vl2/Classic_maps_v1.vl2/shapes/borg11.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb index 80ddaeb3..14a0f1f3 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2flag.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb index c5ef9cb4..b611079e 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2heavy_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb index 52205006..786ada3d 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_female.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb index 8e8726fa..e03e891d 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2light_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb index 540783e8..211fcb70 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_female.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb index 2b4a6922..28d57ba8 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2medium_male.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb index a1c99d0e..538e05c3 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_chaingun.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb index 365125be..02eae975 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_disc.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb index 36d81433..602c0ece 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_grenade_launcher.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb index 3ecef9db..f2d6844d 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_mortar.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb index 5629686d..24e34589 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/TR2weapon_shocklance.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_1.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_1.glb index 3fd08e38..1237f35d 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_1.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_1.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_2.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_2.glb index dc73124d..6414f0ca 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_2.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_2.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_3.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_3.glb index 8b7824aa..4fda4480 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_3.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_3.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_4.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_4.glb index ae6456ba..3d23a7d3 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_4.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/billboard_4.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_back.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_back.glb index 8d797e62..098d35f1 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_back.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_back.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_panel.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_panel.glb index 8826d4b0..602230d6 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_panel.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_panel.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_side.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_side.glb index 2ab8a8b8..07be0aac 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_side.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_side.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_top.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_top.glb index 8c7d7fad..bb615ecd 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_top.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/goal_top.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_back.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_back.glb index b35cbf98..11818bb3 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_back.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_back.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_side.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_side.glb index a60af8ec..6a652fc0 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_side.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_side.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_top.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_top.glb index bca0f190..6c14ea20 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_top.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/gold_goal_top.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/golden_pole.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/golden_pole.glb index c45cb5ec..3a4dfac8 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/golden_pole.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/golden_pole.glb differ diff --git a/docs/base/@vl2/TR2final105-client.vl2/shapes/silver_pole.glb b/docs/base/@vl2/TR2final105-client.vl2/shapes/silver_pole.glb index 52a92cda..dcfd2c8b 100644 Binary files a/docs/base/@vl2/TR2final105-client.vl2/shapes/silver_pole.glb and b/docs/base/@vl2/TR2final105-client.vl2/shapes/silver_pole.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_chaingun.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_chaingun.glb index d17c7249..7ac81c35 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_chaingun.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_chaingun.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_disc.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_disc.glb index 97f5f57c..8592dc54 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_disc.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_disc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_grenade.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_grenade.glb index d696cf90..00bb0ebb 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_grenade.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_grenade.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_mine.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_mine.glb index 75bb790b..ace02eda 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_mine.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_mine.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_missile.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_missile.glb index d28b996a..ded714f8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_missile.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_missile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_mortar.glb index bf304b1d..b0a7dd7a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb index e0ff74d4..0fb179a1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/ammo_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb index 693ff219..b40357be 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_honor.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb index aaaa159f..8b811d74 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_strength.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb b/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb index 8d5acbe3..8fbc0b36 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb and b/docs/base/@vl2/shapes.vl2/shapes/banner_unity.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/beacon.glb b/docs/base/@vl2/shapes.vl2/shapes/beacon.glb index 100831c8..d4cbbb91 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/beacon.glb and b/docs/base/@vl2/shapes.vl2/shapes/beacon.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bio_player_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/bio_player_debris.glb index 1203556d..458b0a48 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bio_player_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/bio_player_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb index 7d1a7377..38e431c4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_heavy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb index 6914b79b..1b9dd13b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_light.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb b/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb index d2a283f6..707dee93 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb and b/docs/base/@vl2/shapes.vl2/shapes/bioderm_medium.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bmiscf.glb b/docs/base/@vl2/shapes.vl2/shapes/bmiscf.glb index e7672c08..dbbda744 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bmiscf.glb and b/docs/base/@vl2/shapes.vl2/shapes/bmiscf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bomb.glb b/docs/base/@vl2/shapes.vl2/shapes/bomb.glb index efc65d0f..859804c1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bomb.glb and b/docs/base/@vl2/shapes.vl2/shapes/bomb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/bombers_eye.glb b/docs/base/@vl2/shapes.vl2/shapes/bombers_eye.glb index ef0e348a..470929c5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/bombers_eye.glb and b/docs/base/@vl2/shapes.vl2/shapes/bombers_eye.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg1.glb b/docs/base/@vl2/shapes.vl2/shapes/borg1.glb index d149cbb7..99ca36fc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg1.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg1.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg12.glb b/docs/base/@vl2/shapes.vl2/shapes/borg12.glb index a8176caf..7272f41c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg12.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg12.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg13.glb b/docs/base/@vl2/shapes.vl2/shapes/borg13.glb index 06d7baea..98ca9ad0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg13.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg13.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg15.glb b/docs/base/@vl2/shapes.vl2/shapes/borg15.glb index 62733dd5..85da1f1b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg15.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg15.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg16.glb b/docs/base/@vl2/shapes.vl2/shapes/borg16.glb index e83e619f..15816586 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg16.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg16.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg17.glb b/docs/base/@vl2/shapes.vl2/shapes/borg17.glb index 8d29b29d..272185f5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg17.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg17.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg18.glb b/docs/base/@vl2/shapes.vl2/shapes/borg18.glb index 9e54650a..f8466e64 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg18.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg18.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg19.glb b/docs/base/@vl2/shapes.vl2/shapes/borg19.glb index 0bd5b8af..aeeaedb2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg19.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg19.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg2.glb b/docs/base/@vl2/shapes.vl2/shapes/borg2.glb index 4aeffb6c..ed256708 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg2.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg2.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg20.glb b/docs/base/@vl2/shapes.vl2/shapes/borg20.glb index 5c3807d6..632eb2c2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg20.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg20.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg23.glb b/docs/base/@vl2/shapes.vl2/shapes/borg23.glb index 7ec91a9a..0bfa49ec 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg23.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg23.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg25.glb b/docs/base/@vl2/shapes.vl2/shapes/borg25.glb index 2cc07fcb..f09b2ded 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg25.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg25.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg3.glb b/docs/base/@vl2/shapes.vl2/shapes/borg3.glb new file mode 100644 index 00000000..e75e304b Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/borg3.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg31.glb b/docs/base/@vl2/shapes.vl2/shapes/borg31.glb index 4c260f73..9604677b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg31.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg31.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg32.glb b/docs/base/@vl2/shapes.vl2/shapes/borg32.glb index 872c00de..bdea7e55 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg32.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg32.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg33.glb b/docs/base/@vl2/shapes.vl2/shapes/borg33.glb index 7161f8f4..db846e9d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg33.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg33.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg34.glb b/docs/base/@vl2/shapes.vl2/shapes/borg34.glb index 50416f6c..ca41aa5b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg34.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg34.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg4.glb b/docs/base/@vl2/shapes.vl2/shapes/borg4.glb index dee2829b..2aed2c44 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg4.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg4.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg5.glb b/docs/base/@vl2/shapes.vl2/shapes/borg5.glb index dd937e7c..7474fb2f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg5.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg5.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg6.glb b/docs/base/@vl2/shapes.vl2/shapes/borg6.glb index cd3cc099..79592d34 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg6.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg6.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg7.glb b/docs/base/@vl2/shapes.vl2/shapes/borg7.glb index d80bd606..096426f2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg7.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg7.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/borg8.glb b/docs/base/@vl2/shapes.vl2/shapes/borg8.glb index a26b0c84..0ebc670a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/borg8.glb and b/docs/base/@vl2/shapes.vl2/shapes/borg8.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/camera.glb b/docs/base/@vl2/shapes.vl2/shapes/camera.glb index d7aff978..f8c461f3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/camera.glb and b/docs/base/@vl2/shapes.vl2/shapes/camera.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb b/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb new file mode 100644 index 00000000..ba49b02d Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/chaingun_shot.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/debris_generic.glb b/docs/base/@vl2/shapes.vl2/shapes/debris_generic.glb index de79cc57..3567906a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/debris_generic.glb and b/docs/base/@vl2/shapes.vl2/shapes/debris_generic.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/debris_generic_small.glb b/docs/base/@vl2/shapes.vl2/shapes/debris_generic_small.glb index 8c3918cf..a0032bf4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/debris_generic_small.glb and b/docs/base/@vl2/shapes.vl2/shapes/debris_generic_small.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/debris_player.glb b/docs/base/@vl2/shapes.vl2/shapes/debris_player.glb index f5aecdce..f3e99a4f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/debris_player.glb and b/docs/base/@vl2/shapes.vl2/shapes/debris_player.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb index beb9f313..da15e825 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb index 683f655f..65a32dd6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_inventory.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb index 0b49a1b7..1088eada 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_motion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb index e212db99..b93d060f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb and b/docs/base/@vl2/shapes.vl2/shapes/deploy_sensor_pulse.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/disc.glb b/docs/base/@vl2/shapes.vl2/shapes/disc.glb index 55ed6674..f6735324 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/disc.glb and b/docs/base/@vl2/shapes.vl2/shapes/disc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb new file mode 100644 index 00000000..49966bf5 Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/disc_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dmiscf.glb b/docs/base/@vl2/shapes.vl2/shapes/dmiscf.glb index 5cac7b40..d625a6ca 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dmiscf.glb and b/docs/base/@vl2/shapes.vl2/shapes/dmiscf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dorg15.glb b/docs/base/@vl2/shapes.vl2/shapes/dorg15.glb index 225097c1..d9fd84a8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dorg15.glb and b/docs/base/@vl2/shapes.vl2/shapes/dorg15.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dorg16.glb b/docs/base/@vl2/shapes.vl2/shapes/dorg16.glb index 9a307cd2..0965cb00 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dorg16.glb and b/docs/base/@vl2/shapes.vl2/shapes/dorg16.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dorg17.glb b/docs/base/@vl2/shapes.vl2/shapes/dorg17.glb index 577d72fd..cfe069eb 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dorg17.glb and b/docs/base/@vl2/shapes.vl2/shapes/dorg17.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dorg18.glb b/docs/base/@vl2/shapes.vl2/shapes/dorg18.glb index fd66dfc8..1535c134 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dorg18.glb and b/docs/base/@vl2/shapes.vl2/shapes/dorg18.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/dorg19.glb b/docs/base/@vl2/shapes.vl2/shapes/dorg19.glb index 770d08f6..e326c841 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/dorg19.glb and b/docs/base/@vl2/shapes.vl2/shapes/dorg19.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb index 2d07beec..1b375c2b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/effect_plasma_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb b/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb index 7e0dce28..e8ec5e08 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb and b/docs/base/@vl2/shapes.vl2/shapes/energy_bolt.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb index ba264eb2..c6a4a3dc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/energy_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb b/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb index 1f4a476a..4d50a38c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb and b/docs/base/@vl2/shapes.vl2/shapes/ext_flagstand.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/flag.glb b/docs/base/@vl2/shapes.vl2/shapes/flag.glb index f97ef85f..e4cb9731 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/flag.glb and b/docs/base/@vl2/shapes.vl2/shapes/flag.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb b/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb index 890c1691..ccc5bc1f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb and b/docs/base/@vl2/shapes.vl2/shapes/gravemarker_1.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade.glb index 6b6fb802..e68998fd 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb index b4c1178f..31f53915 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade_flare.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb index 8ca5fc93..989f9587 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb and b/docs/base/@vl2/shapes.vl2/shapes/grenade_flash.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb b/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb new file mode 100644 index 00000000..26dfcecc Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/grenade_projectile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb b/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb index 5efff44e..df899c42 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/heavy_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/heavy_male_dead.glb b/docs/base/@vl2/shapes.vl2/shapes/heavy_male_dead.glb index 7e1a0340..62e44512 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/heavy_male_dead.glb and b/docs/base/@vl2/shapes.vl2/shapes/heavy_male_dead.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/huntersflag.glb b/docs/base/@vl2/shapes.vl2/shapes/huntersflag.glb index 20879fa4..20976a0e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/huntersflag.glb and b/docs/base/@vl2/shapes.vl2/shapes/huntersflag.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/int_flagstand.glb b/docs/base/@vl2/shapes.vl2/shapes/int_flagstand.glb index a1d49831..f4fa147e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/int_flagstand.glb and b/docs/base/@vl2/shapes.vl2/shapes/int_flagstand.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/light_female.glb b/docs/base/@vl2/shapes.vl2/shapes/light_female.glb index af378ed2..9a89dae5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/light_female.glb and b/docs/base/@vl2/shapes.vl2/shapes/light_female.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/light_male.glb b/docs/base/@vl2/shapes.vl2/shapes/light_male.glb index acd491f6..db8848e5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/light_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/light_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/light_male_dead.glb b/docs/base/@vl2/shapes.vl2/shapes/light_male_dead.glb index fb642b19..93cbc3be 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/light_male_dead.glb and b/docs/base/@vl2/shapes.vl2/shapes/light_male_dead.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb b/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb index 49fab10e..d0950f99 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb and b/docs/base/@vl2/shapes.vl2/shapes/medium_female.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb b/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb index f2daa909..825d4851 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb and b/docs/base/@vl2/shapes.vl2/shapes/medium_male.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/medium_male_dead.glb b/docs/base/@vl2/shapes.vl2/shapes/medium_male_dead.glb index e57405ba..e9cdddc5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/medium_male_dead.glb and b/docs/base/@vl2/shapes.vl2/shapes/medium_male_dead.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mine.glb b/docs/base/@vl2/shapes.vl2/shapes/mine.glb index a5d75678..40ff806e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/mine.glb and b/docs/base/@vl2/shapes.vl2/shapes/mine.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb b/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb index a99fe373..85a1ff8c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb and b/docs/base/@vl2/shapes.vl2/shapes/mortar_explosion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb b/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb new file mode 100644 index 00000000..88a73698 Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/mortar_projectile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb b/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb index bb1b3bf4..bdf7ac92 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexus_effect.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb b/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb index e13628ff..193a6107 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexusbase.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb b/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb index 97432d94..9c2aa3dc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb and b/docs/base/@vl2/shapes.vl2/shapes/nexuscap.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/octahedron.glb b/docs/base/@vl2/shapes.vl2/shapes/octahedron.glb new file mode 100644 index 00000000..83a22e98 Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/octahedron.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_aa.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_aa.glb index 5acea557..eb17c4e2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_aa.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_aa.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_elf.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_elf.glb index 556a9abb..88aef35c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_elf.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_elf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_fusion.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_fusion.glb index 38468307..868d9854 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_fusion.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_fusion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_missile.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_missile.glb index 39e048ce..2392a600 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_missile.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_missile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_mortar.glb index 83f5929c..ac8ead76 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_barrel_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb index e9ec5cca..e824c40e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_inventory.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_inventory.glb index 9b1545db..1d56261a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_inventory.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_inventory.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb index b7fbee80..91af1bce 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_motion.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb index 18f5d7c1..7a774d9b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_sensor_pulse.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreti.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreti.glb index 9a7bbec6..5a610703 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreti.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreti.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreto.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreto.glb index 2743ed19..5a9d175f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreto.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_deploy_turreto.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb index 209f337d..7b29ee6c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_ammo.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb index 6dc09db0..de857585 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_cloaking.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb index 17dafa2a..0091f5c4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_energy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb index 0c47da21..d8a8c4db 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_repair.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb index 6f7a9606..66db7210 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_satchel.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb index c88c8ed5..0584a5fc 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_sensorjammer.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb index 73ec2526..791970a4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb and b/docs/base/@vl2/shapes.vl2/shapes/pack_upgrade_shield.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb b/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb new file mode 100644 index 00000000..7b5a07dd Binary files /dev/null and b/docs/base/@vl2/shapes.vl2/shapes/plasmabolt.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/pmiscf.glb b/docs/base/@vl2/shapes.vl2/shapes/pmiscf.glb index d6c8c80b..1f59a9d0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/pmiscf.glb and b/docs/base/@vl2/shapes.vl2/shapes/pmiscf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg1.glb b/docs/base/@vl2/shapes.vl2/shapes/porg1.glb index 92298ee2..bd512130 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg1.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg1.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg2.glb b/docs/base/@vl2/shapes.vl2/shapes/porg2.glb index 78bf12e6..519d18c7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg2.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg2.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg20.glb b/docs/base/@vl2/shapes.vl2/shapes/porg20.glb index 874dadc7..b4365c03 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg20.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg20.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg22.glb b/docs/base/@vl2/shapes.vl2/shapes/porg22.glb index 8f0adaab..59c1f21c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg22.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg22.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg3.glb b/docs/base/@vl2/shapes.vl2/shapes/porg3.glb index 3d3a6e59..6c0ef070 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg3.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg3.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg4.glb b/docs/base/@vl2/shapes.vl2/shapes/porg4.glb index 002850a6..6b7c0147 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg4.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg4.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg5.glb b/docs/base/@vl2/shapes.vl2/shapes/porg5.glb index 7a8ad7d3..5075baed 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg5.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg5.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/porg6.glb b/docs/base/@vl2/shapes.vl2/shapes/porg6.glb index adc72cce..d7c743ab 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/porg6.glb and b/docs/base/@vl2/shapes.vl2/shapes/porg6.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb b/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb index 94f71766..21c6941b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb and b/docs/base/@vl2/shapes.vl2/shapes/repair_kit.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb b/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb index 12c15c98..630f31a4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb and b/docs/base/@vl2/shapes.vl2/shapes/repair_patch.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/reticle_bomber.glb b/docs/base/@vl2/shapes.vl2/shapes/reticle_bomber.glb index ca650012..052b6c0d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/reticle_bomber.glb and b/docs/base/@vl2/shapes.vl2/shapes/reticle_bomber.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb index fe69d731..0b08f6c0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb index 3fff266e..299352e6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb and b/docs/base/@vl2/shapes.vl2/shapes/sensor_pulse_medium.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/smiscf.glb b/docs/base/@vl2/shapes.vl2/shapes/smiscf.glb index c2c2e665..198b6fd0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/smiscf.glb and b/docs/base/@vl2/shapes.vl2/shapes/smiscf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb b/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb index e7ad2141..c4df26e9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb and b/docs/base/@vl2/shapes.vl2/shapes/solarpanel.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg20.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg20.glb index 7892bc31..83281910 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg20.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg20.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg21.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg21.glb index 2d33df64..bb7989af 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg21.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg21.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg22.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg22.glb index 769f65c6..19383924 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg22.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg22.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb index 0d85184a..e8b97d24 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg23.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/sorg24.glb b/docs/base/@vl2/shapes.vl2/shapes/sorg24.glb index d614f4cb..b5b0065f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/sorg24.glb and b/docs/base/@vl2/shapes.vl2/shapes/sorg24.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable1l.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable1l.glb index 0cbed72d..8690181c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable1l.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable1l.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable1m.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable1m.glb index 3fdea659..ab7e86cb 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable1m.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable1m.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable1s.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable1s.glb index 561ba7a9..717ed7a1 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable1s.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable1s.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable2l.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable2l.glb index 793902d8..bfce33b6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable2l.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable2l.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable2m.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable2m.glb index 7718c693..29e8d752 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable2m.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable2m.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable2s.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable2s.glb index a07be05e..9da9a4b3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable2s.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable2s.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable3l.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable3l.glb index 73aba775..db473adf 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable3l.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable3l.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable3m.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable3m.glb index a695690e..3107dd18 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable3m.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable3m.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable3s.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable3s.glb index f9f2fe6a..dc551157 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable3s.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable3s.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable4l.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable4l.glb index ccd37025..0f6577ad 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable4l.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable4l.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable4m.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable4m.glb index 72d06b7a..232eff85 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable4m.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable4m.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable5l.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable5l.glb index ebbd8d6e..7997023d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable5l.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable5l.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/stackable5m.glb b/docs/base/@vl2/shapes.vl2/shapes/stackable5m.glb index d6dadbe8..90668349 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/stackable5m.glb and b/docs/base/@vl2/shapes.vl2/shapes/stackable5m.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb b/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb index b74a7d71..f00631f3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_generator_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb b/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb index ee8f9721..3c0c789c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_inv_human.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb b/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb index c83117c7..f6d2f4d5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_inv_mpb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb b/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb index f94ddc9c..93c43b7f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb and b/docs/base/@vl2/shapes.vl2/shapes/station_teleport.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/statue_base.glb b/docs/base/@vl2/shapes.vl2/shapes/statue_base.glb index cacd3a69..98aea06c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/statue_base.glb and b/docs/base/@vl2/shapes.vl2/shapes/statue_base.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/statue_hmale.glb b/docs/base/@vl2/shapes.vl2/shapes/statue_hmale.glb index 58e70443..6048d941 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/statue_hmale.glb and b/docs/base/@vl2/shapes.vl2/shapes/statue_hmale.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/statue_lfemale.glb b/docs/base/@vl2/shapes.vl2/shapes/statue_lfemale.glb index fb1f7c41..d948e46f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/statue_lfemale.glb and b/docs/base/@vl2/shapes.vl2/shapes/statue_lfemale.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/statue_lmale.glb b/docs/base/@vl2/shapes.vl2/shapes/statue_lmale.glb index 5be22081..0bd3b717 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/statue_lmale.glb and b/docs/base/@vl2/shapes.vl2/shapes/statue_lmale.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/statue_plaque.glb b/docs/base/@vl2/shapes.vl2/shapes/statue_plaque.glb index d182ee02..c016bff7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/statue_plaque.glb and b/docs/base/@vl2/shapes.vl2/shapes/statue_plaque.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/switch.glb b/docs/base/@vl2/shapes.vl2/shapes/switch.glb index d720f311..d00dba02 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/switch.glb and b/docs/base/@vl2/shapes.vl2/shapes/switch.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb index b1c83a78..44e7a2d6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_bd.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb index 8d776add..e7f6bc4b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_be.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb index 88d9a699..0b2a9c81 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_ds.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb index 2acdd3fd..9ecf8503 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_hb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb index 8d5b4c4c..1533b649 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_inf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb index d8339219..1ca638a2 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_projector.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb index e599fdde..2875a23e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_storm.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb index 6b4c0088..4e5438c7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb and b/docs/base/@vl2/shapes.vl2/shapes/teamlogo_sw.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb index a37ed65d..aae483de 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_aa_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb index 225a7af8..96681926 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb index 1d0ee0c1..633161d4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_assaulttank_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb index 1765ded1..06a3bf15 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_base_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb index 31fc9e0b..b7ac3c3a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_base_mpb.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb index c31226d0..97760ab9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrell.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb index 8a884f21..e0924bf8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_barrelr.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb index 1d567a7c..92c627ec 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_belly_base.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb index a58e97b7..aa244a16 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_elf_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb index 0755bd32..c26f514a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_fusion_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb index f2c66e23..b5be3f68 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb index bc18fd45..4db3e322 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb index 62d2d3b9..97851f9b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_indoor_deployw.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb index 23918550..1c02ddaa 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_missile_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb index a49da079..6a2bb98e 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_mortar_large.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_muzzlepoint.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_muzzlepoint.glb index ef0e348a..2d9112d8 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_muzzlepoint.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_muzzlepoint.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb index c95d2448..6123a055 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_outdoor_deploy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb index 51a86a2d..e7a7859b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_sentry.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb index cc3b3783..c645f23f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelchain.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb index 5bb79ffa..54661bff 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_barrelmortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb index 26f0c0d9..dc466004 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb and b/docs/base/@vl2/shapes.vl2/shapes/turret_tank_base.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb index eb288d71..5ef9ed68 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb index 676a53e4..96eca25c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_bomber_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb index a293e9f1..0a590ff3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb index 59aaf2d8..e18a6cf5 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_hapc_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb index 28604f1c..40f1978c 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_debris.glb index 4aba063c..dcdfd854 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_wreck.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_wreck.glb index cd7b30aa..8ad629e7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_wreck.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_air_scout_wreck.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb index 163d21fc..2ea266c3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb index e2345afd..bc8eec0f 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_scout_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb index bf89de5f..91405000 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_debris.glb index 62a3bdfe..2970a862 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb index ce3d9e77..d898ac6a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_grav_tank_wreck.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb index 543e73ed..8c53ee68 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_debris.glb index 62a3bdfe..2970a862 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb index ce3d9e77..d898ac6a 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_assault_wreck.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb index d2d31931..03e6a050 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase_debris.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase_debris.glb index d1bc5819..80ad3b12 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase_debris.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_land_mpbase_debris.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb index 2cd72df8..0b019e46 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb index db6d1f35..cf53f159 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb and b/docs/base/@vl2/shapes.vl2/shapes/vehicle_pad_station.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb index 6588c3ed..93683613 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun_ammocasing.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun_ammocasing.glb index f80cdb92..8f45d103 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun_ammocasing.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_chaingun_ammocasing.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb index 71ff3e42..79f7bd37 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb index 903d4df3..d536d0f6 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_elf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb index 12a3b373..e9f451e7 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy_vehicle.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy_vehicle.glb index e9b8b5ef..d04ac1df 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_energy_vehicle.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_energy_vehicle.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb index 1dde46fb..e056ccde 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb index b9f9d728..8bd874d0 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_casement.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_casement.glb index cd33da99..27810a5d 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_casement.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_casement.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_fleschette.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_fleschette.glb index be2bd36b..47b76ae3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_fleschette.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_fleschette.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_projectile.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_projectile.glb index 1c1a96cf..6e61f9b3 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_projectile.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_missile_projectile.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb index b0aa16d3..a446a984 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_mortar.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb index 76546e01..27815435 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_plasma.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb index 1cb078ce..d8f035ea 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_repair.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb index 28c3ce1a..a0a06023 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_shocklance.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb index 3b465234..7820769b 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_sniper.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/weapon_targeting.glb b/docs/base/@vl2/shapes.vl2/shapes/weapon_targeting.glb index 53a437e6..14e07e21 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/weapon_targeting.glb and b/docs/base/@vl2/shapes.vl2/shapes/weapon_targeting.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xmiscf.glb b/docs/base/@vl2/shapes.vl2/shapes/xmiscf.glb index 8fe2cda8..9c9ce684 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xmiscf.glb and b/docs/base/@vl2/shapes.vl2/shapes/xmiscf.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg20.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg20.glb index 33cf7039..1647e948 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg20.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg20.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg21.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg21.glb index dbe43bb3..737007a4 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg21.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg21.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg3.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg3.glb index 11e310b3..14688677 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg3.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg3.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb index 9c1dad49..b0ab5538 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg4.glb differ diff --git a/docs/base/@vl2/shapes.vl2/shapes/xorg5.glb b/docs/base/@vl2/shapes.vl2/shapes/xorg5.glb index 29757c00..705866d9 100644 Binary files a/docs/base/@vl2/shapes.vl2/shapes/xorg5.glb and b/docs/base/@vl2/shapes.vl2/shapes/xorg5.glb differ diff --git a/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb b/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb new file mode 100644 index 00000000..737ef945 Binary files /dev/null and b/docs/base/@vl2/z_mappacks/CTF/Classic_maps_v1.vl2/shapes/borg11.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/C_BaseLoPro.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/C_BaseLoPro.glb index 761b062a..8b6c8245 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/C_BaseLoPro.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/C_BaseLoPro.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg16-Autumn.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg16-Autumn.glb index 50d6017b..7aebb61b 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg16-Autumn.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg16-Autumn.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg19-Autumn.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg19-Autumn.glb index 7a65411e..01f18bd0 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg19-Autumn.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/borg19-Autumn.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/porg1-dark.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/porg1-dark.glb index 74aa8995..84f6314f 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/porg1-dark.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/porg1-dark.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TCmug.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TCmug.glb index f0016ed5..128097b7 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TCmug.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TCmug.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TNmug.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TNmug.glb index 83d04f10..b1ab834a 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TNmug.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-TNmug.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-chocotaco.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-chocotaco.glb index a52414d9..ca57da90 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-chocotaco.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-chocotaco.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-goonflag.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-goonflag.glb index 14c6c873..9b53971c 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-goonflag.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-goonflag.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-samifin.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-samifin.glb index 7f6f6807..919d8f82 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-samifin.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-samifin.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-santahat.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-santahat.glb index 3a79c2df..8640c88c 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-santahat.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-santahat.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-taobook.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-taobook.glb index d7ba0bd1..136a3988 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-taobook.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-taobook.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-turtle.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-turtle.glb index 3fab0b07..2e8c2f5d 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-turtle.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/rst-turtle.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/vend.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/vend.glb index 7ced25e5..73ccbae6 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/vend.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2/shapes/vend.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/C_BaseLoPro.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/C_BaseLoPro.glb index 761b062a..8b6c8245 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/C_BaseLoPro.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/C_BaseLoPro.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg16-Autumn.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg16-Autumn.glb index 50d6017b..7aebb61b 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg16-Autumn.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg16-Autumn.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg19-Autumn.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg19-Autumn.glb index 7a65411e..01f18bd0 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg19-Autumn.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/borg19-Autumn.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/porg1-dark.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/porg1-dark.glb index 74aa8995..84f6314f 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/porg1-dark.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/porg1-dark.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TCmug.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TCmug.glb index f0016ed5..128097b7 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TCmug.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TCmug.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TNmug.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TNmug.glb index 83d04f10..b1ab834a 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TNmug.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-TNmug.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-chocotaco.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-chocotaco.glb index a52414d9..ca57da90 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-chocotaco.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-chocotaco.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-goonflag.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-goonflag.glb index 14c6c873..9b53971c 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-goonflag.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-goonflag.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-samifin.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-samifin.glb index 7f6f6807..919d8f82 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-samifin.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-samifin.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-santahat.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-santahat.glb index 3a79c2df..8640c88c 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-santahat.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-santahat.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-taobook.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-taobook.glb index d7ba0bd1..136a3988 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-taobook.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-taobook.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-turtle.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-turtle.glb index 3fab0b07..2e8c2f5d 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-turtle.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/rst-turtle.glb differ diff --git a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/vend.glb b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/vend.glb index 7ced25e5..73ccbae6 100644 Binary files a/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/vend.glb and b/docs/base/@vl2/z_mappacks/zDMP-4.7.3DX.vl2/shapes/vend.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/T1ELF.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/T1ELF.glb index ca308600..6705cb68 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/T1ELF.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/T1ELF.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/bTer.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/bTer.glb index 0b057ca7..fefd91b3 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/bTer.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/bTer.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb index 30b42b1e..4d72bdd0 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/buildStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb index 6b00f14a..794af0d6 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/cannonTip.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/catMaxLoaf.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/catMaxLoaf.glb index e6d5e426..2402799b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/catMaxLoaf.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/catMaxLoaf.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb index afdf273a..a569de61 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsFlame.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb index fffdc329..5d17028d 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/dsPlane.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/engSphere.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/engSphere.glb index 46b8e35d..6c197124 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/engSphere.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/engSphere.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb index 24992c69..6a1824bb 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceBox.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb index 8fd42c3f..768a4f2a 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/faceSphere.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFoe.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFoe.glb index 6b3556a6..013f5e50 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFoe.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFoe.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFriend.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFriend.glb index 44d84b6f..575a6299 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFriend.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/flagIconFriend.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/foeMark.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/foeMark.glb index 87d77dbd..9a3c7da1 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/foeMark.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/foeMark.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/friendMark.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/friendMark.glb index 4b088f11..096044ab 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/friendMark.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/friendMark.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb index 801beda2..e297ea6d 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireGun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb index a74d0dda..eae15fe2 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/hellFireTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/iceCube.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/iceCube.glb index 7deaf971..9ff7d818 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/iceCube.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/iceCube.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/paperFlag.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/paperFlag.glb index cb01275c..89676fa4 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/paperFlag.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/paperFlag.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/redeemer.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/redeemer.glb index 019c7bf5..07573b41 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/redeemer.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/redeemer.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereA.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereA.glb index 9eb9b092..a45f104b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereA.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereA.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereB.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereB.glb index 222a802c..2acf0799 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereB.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/skySphereB.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb index b9cd6e1d..7c454bc2 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1CMDStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb index 1f9525a1..ac997871 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Chaingun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb index dade94bb..6b3f549e 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepAmmo.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb index d6044417..b9e8e64b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy_Pack.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy_Pack.glb index df5c2d7a..9c90843e 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy_Pack.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1DepInvy_Pack.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb index f8f1e8c0..2756d9f7 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1GrenadeLauncher.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb index e1e6aa9b..9e7cd992 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1LSensor.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb index 613d095c..49410914 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1MisTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb index 18d17d7a..83ec0e35 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1PowerGen.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb index a5478aec..b7e764df 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret_Pack.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret_Pack.glb index 956fb100..94703940 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret_Pack.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RemoteTurret_Pack.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb index bbc38996..30cd3f78 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPack.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb index b3524ed1..85a2b00f 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1RepairPackGun.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb index 8ee27340..c6a93e24 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Sentry.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb index 9cc08e7c..6af7938f 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1Solar.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb index fa431fe4..b3697458 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1TargetLaser.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb index 37f0bb15..0405686e 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehPad.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb index ba1dce1c..0ec0fddd 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1VehStation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb index 16d82a40..d5b4eed5 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1ammopad.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflag.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflag.glb index 1de431e3..dae1e413 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflag.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflag.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagB.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagB.glb index 394953c6..7b9ea89d 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagB.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagB.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagD.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagD.glb index dfd02894..0f143b92 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagD.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagD.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagP.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagP.glb index 2e34206f..e7f596be 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagP.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagP.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagS.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagS.glb index 557eea35..1b91ce88 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagS.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1baseflagS.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb index 866e6198..d7566a7b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1blaster.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb index 724e9522..623a4952 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1disc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb index cdd68734..f0dd9032 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1elfTurret.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb index 3f6c307d..06fd2a8f 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb index b6311e28..03b509b4 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1flyer2.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb index 108ffb44..99842d79 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1hpc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb index aee5caae..e3ee8ee5 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1inventorystation.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb index f9c0809d..8a93bd95 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1lpc.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb index c07ef20e..59a119b3 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mSensor.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb index 01f4d121..f93aee7f 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1mortar.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb index 41a4eff4..cd6b967e 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1pGen.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb index 8c9c78ec..15fea7b7 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1plasma.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1sniper.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1sniper.glb index 1fcd6f7d..f96f665b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1sniper.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t1sniper.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb index c94122c2..7fb18a79 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo_Pack.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo_Pack.glb index 3df8fcf0..fdba4f0b 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo_Pack.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/t2DepAmmo_Pack.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/tCube.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/tCube.glb index 7deaf971..9ff7d818 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/tCube.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/tCube.glb differ diff --git a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/targetCube.glb b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/targetCube.glb index 0fee5bb8..de282779 100644 Binary files a/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/targetCube.glb and b/docs/base/@vl2/z_mappacks/z_DMP2-V0.6.vl2/shapes/targetCube.glb differ diff --git a/docs/index.html b/docs/index.html index 8f0edca1..ee9c06a0 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 549e3096..330e2e17 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -3,14 +3,15 @@ 3:I[39756,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 4:I[37457,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"default"] 5:I[47257,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ClientPageRoot"] -6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] +6:I[31713,["/t2-mapper/_next/static/chunks/e6da73430a674f20.js","/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","/t2-mapper/_next/static/chunks/12e7daed7311216f.js","/t2-mapper/_next/static/chunks/bb0aa1c978feffed.js"],"default"] 9:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"OutletBoundary"] a:"$Sreact.suspense" c:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"ViewportBoundary"] e:I[97367,["/t2-mapper/_next/static/chunks/4fd93823156e59e8.js"],"MetadataBoundary"] 10:I[68027,[],"default"] -:HL["/t2-mapper/_next/static/chunks/284925ee1f24c201.css","style"] -0:{"P":null,"b":"-NrDAGL0vu_8RrgSU0FFY","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/284925ee1f24c201.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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"]}}],[["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/15f5b04504a3a132.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/5619c5b2b1355f74.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/eced4fe19bc9da99.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/fcdc907286f09d63.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.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} +:HL["/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","style"] +:HL["/t2-mapper/_next/static/chunks/afff663ba7029ccf.css","style"] +0:{"P":null,"b":"TA1NEd7uhnyFsTRk4wMjb","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/t2-mapper/_next/static/chunks/f0f828674b39f3d8.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/e6da73430a674f20.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/afff663ba7029ccf.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/t2-mapper/_next/static/chunks/781bfa3c9aab0c18.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/t2-mapper/_next/static/chunks/93b588fa7f31935c.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/t2-mapper/_next/static/chunks/22ebafda1e5f0224.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/t2-mapper/_next/static/chunks/39f1afbfab5559a9.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/t2-mapper/_next/static/chunks/12e7daed7311216f.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/t2-mapper/_next/static/chunks/bb0aa1c978feffed.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/next-env.d.ts b/next-env.d.ts index 1d9923a0..9edff1c7 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./docs/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/package.json b/package.json index 884cc744..5a0e5556 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react-dom": "^19.2.3", "react-error-boundary": "^6.0.1", "react-icons": "^5.5.0", + "t2-demo-parser": "file:.yalc/t2-demo-parser", "three": "^0.182.0", "unzipper": "^0.12.3", "zustand": "^5.0.9" diff --git a/scripts/blender/dif2gltf.py b/scripts/blender/dif2gltf.py index bc731cd8..041ba37b 100644 --- a/scripts/blender/dif2gltf.py +++ b/scripts/blender/dif2gltf.py @@ -65,6 +65,7 @@ print(f"[dif2gltf] Processing {len(input_files)} file(s)...") total = len(input_files) success_count = 0 failure_count = 0 +failed_paths = [] for i, in_path in enumerate(input_files, start=1): # Derive output path: same location, same name, but .glb/.gltf extension ext = ".gltf" if args.format == "GLTF_SEPARATE" else ".glb" @@ -88,6 +89,7 @@ for i, in_path in enumerate(input_files, start=1): raise RuntimeError(f"Import failed via {op_id}") except Exception: failure_count += 1 + failed_paths.append(in_path) print(f"\n{RED}[dif2gltf] [{i}/{total}] FAIL:{RESET} {in_path}") continue @@ -111,6 +113,7 @@ for i, in_path in enumerate(input_files, start=1): ) if "FINISHED" not in res: failure_count += 1 + failed_paths.append(in_path) print(f"\n{RED}[dif2gltf] [{i}/{total}] FAIL (export):{RESET} {out_path}") continue @@ -118,3 +121,7 @@ for i, in_path in enumerate(input_files, start=1): print(f"{GREEN}[dif2gltf] [{i}/{total}] OK:{RESET} {in_path} -> {out_path}") print(f"[dif2gltf] Done! Converted {success_count} file(s), {failure_count} failed.") +if failed_paths: + print(f"\n{RED}[dif2gltf] Failed paths:{RESET}") + for p in failed_paths: + print(os.path.relpath(p)) diff --git a/scripts/blender/dts2gltf.py b/scripts/blender/dts2gltf.py index 138b2dbb..28d25b72 100644 --- a/scripts/blender/dts2gltf.py +++ b/scripts/blender/dts2gltf.py @@ -65,6 +65,7 @@ print(f"[dts2gltf] Processing {len(input_files)} file(s)...") total = len(input_files) success_count = 0 failure_count = 0 +failed_paths = [] for i, in_path in enumerate(input_files, start=1): # Derive output path: same location, same name, but .glb/.gltf extension ext = ".gltf" if args.format == "GLTF_SEPARATE" else ".glb" @@ -79,11 +80,12 @@ for i, in_path in enumerate(input_files, start=1): # Import print(f"[dts2gltf] [{i}/{total}] Converting: {in_path}") try: - res = op_call(filepath=in_path, merge_verts=True) + res = op_call(filepath=in_path, merge_verts=True, import_sequences=True) if "FINISHED" not in res: raise RuntimeError(f"Import failed via {op_id}") except Exception: failure_count += 1 + failed_paths.append(in_path) print(f"\n{RED}[dts2gltf] [{i}/{total}] FAIL (import):{RESET} {in_path}") continue @@ -100,6 +102,9 @@ for i, in_path in enumerate(input_files, start=1): # Export custom properties, which is where we store the original # resource path. export_extras=True, + # Include armature animations (DTS sequences) + export_animations=True, + export_animation_mode='ACTIONS', # Blender and T2 are Z-up, but these assets are destined for Three.js which # is Y-up. It's easiest to match the Y-up of our destination engine. export_yup=True, @@ -109,6 +114,7 @@ for i, in_path in enumerate(input_files, start=1): ) if "FINISHED" not in res: failure_count += 1 + failed_paths.append(in_path) print(f"\n{RED}[dts2gltf] [{i}/{total}] FAIL (export):{RESET} {out_path}") continue @@ -116,3 +122,7 @@ for i, in_path in enumerate(input_files, start=1): print(f"{GREEN}[dts2gltf] [{i}/{total}] OK:{RESET} {in_path} -> {out_path}") print(f"[dts2gltf] Done! Converted {success_count} file(s), {failure_count} failed.") +if failed_paths: + print(f"\n{RED}[dts2gltf] Failed paths:{RESET}") + for p in failed_paths: + print(os.path.relpath(p)) diff --git a/scripts/check-mount-points.ts b/scripts/check-mount-points.ts new file mode 100644 index 00000000..31d03383 --- /dev/null +++ b/scripts/check-mount-points.ts @@ -0,0 +1,239 @@ +/** + * Extract right-hand mesh centroids from player GLBs and Mountpoint positions + * from weapon GLBs. Used to derive correct mount offsets for demo playback. + */ +import fs from "node:fs/promises"; +import path from "node:path"; + +// Minimal GLB/glTF parser — just enough to read node names and mesh positions. + +interface GltfNode { + name?: string; + mesh?: number; + children?: number[]; + translation?: [number, number, number]; + rotation?: [number, number, number, number]; + scale?: [number, number, number]; +} + +interface GltfAccessor { + bufferView: number; + componentType: number; + count: number; + type: string; + min?: number[]; + max?: number[]; + byteOffset?: number; +} + +interface GltfBufferView { + buffer: number; + byteOffset?: number; + byteLength: number; + byteStride?: number; +} + +interface GltfMesh { + name?: string; + primitives: Array<{ attributes: Record }>; +} + +interface GltfJson { + nodes: GltfNode[]; + meshes?: GltfMesh[]; + accessors?: GltfAccessor[]; + bufferViews?: GltfBufferView[]; +} + +function parseGlb(buffer: Buffer): { json: GltfJson; bin: Buffer } { + const magic = buffer.readUInt32LE(0); + if (magic !== 0x46546c67) throw new Error("Not a GLB file"); + // Chunk 0: JSON + const jsonLen = buffer.readUInt32LE(12); + const jsonStr = buffer.subarray(20, 20 + jsonLen).toString("utf-8"); + const json = JSON.parse(jsonStr) as GltfJson; + // Chunk 1: BIN + const binOffset = 20 + jsonLen; + const binLen = buffer.readUInt32LE(binOffset); + const bin = buffer.subarray(binOffset + 8, binOffset + 8 + binLen); + return { json, bin }; +} + +/** Compute the centroid (average of min/max) of a mesh's POSITION accessor. */ +function getMeshCentroid( + json: GltfJson, + bin: Buffer, + meshIndex: number, +): [number, number, number] | null { + const mesh = json.meshes?.[meshIndex]; + if (!mesh) return null; + const posAccessorIdx = mesh.primitives[0]?.attributes?.POSITION; + if (posAccessorIdx == null) return null; + const accessor = json.accessors?.[posAccessorIdx]; + if (!accessor || !accessor.min || !accessor.max) return null; + // Centroid from bounding box + return [ + (accessor.min[0] + accessor.max[0]) / 2, + (accessor.min[1] + accessor.max[1]) / 2, + (accessor.min[2] + accessor.max[2]) / 2, + ]; +} + +/** Get the world-space position of a named node, accounting for parent chain. */ +function getNodeWorldPosition( + json: GltfJson, + nodeName: string, +): [number, number, number] | null { + // Build parent map + const parentMap = new Map(); + for (let i = 0; i < json.nodes.length; i++) { + const node = json.nodes[i]; + if (node.children) { + for (const child of node.children) { + parentMap.set(child, i); + } + } + } + + // Find the node + const nodeIdx = json.nodes.findIndex( + (n) => n.name?.toLowerCase() === nodeName.toLowerCase(), + ); + if (nodeIdx === -1) return null; + + // Walk up parent chain accumulating translations (ignoring rotation for now) + let pos: [number, number, number] = [0, 0, 0]; + let current: number | undefined = nodeIdx; + while (current != null) { + const node = json.nodes[current]; + const t = node.translation; + if (t) { + pos[0] += t[0]; + pos[1] += t[1]; + pos[2] += t[2]; + } + current = parentMap.get(current); + } + return pos; +} + +const baseDir = "/Users/exogen/Projects/t2-mapper/docs/base"; + +// Player models +const playerModels = [ + "@vl2/shapes.vl2/shapes/light_male.glb", + "@vl2/shapes.vl2/shapes/medium_male.glb", + "@vl2/shapes.vl2/shapes/heavy_male.glb", + "@vl2/shapes.vl2/shapes/bioderm_light.glb", + "@vl2/shapes.vl2/shapes/bioderm_medium.glb", + "@vl2/shapes.vl2/shapes/bioderm_heavy.glb", + "@vl2/shapes.vl2/shapes/light_female.glb", + "@vl2/shapes.vl2/shapes/medium_female.glb", +]; + +// Weapon models +const weaponModels = [ + "@vl2/shapes.vl2/shapes/weapon_disc.glb", + "@vl2/shapes.vl2/shapes/weapon_chaingun.glb", + "@vl2/shapes.vl2/shapes/weapon_mortar.glb", + "@vl2/shapes.vl2/shapes/weapon_plasma.glb", + "@vl2/shapes.vl2/shapes/weapon_grenade_launcher.glb", + "@vl2/shapes.vl2/shapes/weapon_repair.glb", + "@vl2/shapes.vl2/shapes/weapon_shocklance.glb", + "@vl2/shapes.vl2/shapes/weapon_missile.glb", + "@vl2/shapes.vl2/shapes/weapon_sniper.glb", + "@vl2/shapes.vl2/shapes/weapon_energy.glb", + "@vl2/shapes.vl2/shapes/weapon_elf.glb", + "@vl2/shapes.vl2/shapes/weapon_targeting.glb", +]; + +console.log("=== PLAYER RIGHT-HAND MESH CENTROIDS ===\n"); + +for (const rel of playerModels) { + const filePath = path.join(baseDir, rel); + try { + const buf = await fs.readFile(filePath); + const { json, bin } = parseGlb(buf); + const name = path.basename(rel, ".glb"); + + // Find right-hand mesh node + const rhNodeIdx = json.nodes.findIndex((n) => { + const lower = n.name?.toLowerCase() ?? ""; + return lower.includes("rhand") || lower.includes("r_hand"); + }); + + if (rhNodeIdx === -1) { + console.log(`${name}: no rhand mesh found`); + continue; + } + + const rhNode = json.nodes[rhNodeIdx]; + let centroid: [number, number, number] | null = null; + if (rhNode.mesh != null) { + centroid = getMeshCentroid(json, bin, rhNode.mesh); + } + + // Also get the node's own translation + const translation = rhNode.translation ?? [0, 0, 0]; + + // Apply ShapeModel's 90° Y rotation: (x,y,z) → (z, y, -x) + if (centroid) { + const entitySpace: [number, number, number] = [ + centroid[2], + centroid[1], + -centroid[0], + ]; + console.log( + `${name}: rhand mesh="${rhNode.name}" glbCentroid=(${centroid.map((v) => v.toFixed(3)).join(", ")}) entitySpace=(${entitySpace.map((v) => v.toFixed(3)).join(", ")})`, + ); + } else { + console.log( + `${name}: rhand node="${rhNode.name}" translation=(${translation.map((v: number) => v.toFixed(3)).join(", ")}) (no mesh centroid)`, + ); + } + } catch (e: any) { + console.log(`${name}: error - ${e.message}`); + } +} + +console.log("\n=== WEAPON MOUNTPOINT POSITIONS ===\n"); + +for (const rel of weaponModels) { + const filePath = path.join(baseDir, rel); + try { + const buf = await fs.readFile(filePath); + const { json } = parseGlb(buf); + const name = path.basename(rel, ".glb"); + + // List all node names + const nodeNames = json.nodes.map((n) => n.name ?? "(unnamed)"); + + // Find Mountpoint + const mpIdx = json.nodes.findIndex((n) => { + const lower = n.name?.toLowerCase() ?? ""; + return lower === "mountpoint"; + }); + + if (mpIdx === -1) { + console.log(`${name}: NO Mountpoint node. Nodes: [${nodeNames.join(", ")}]`); + continue; + } + + // Get world position (walking parent chain) + const worldPos = getNodeWorldPosition(json, "Mountpoint"); + const localTrans = json.nodes[mpIdx].translation ?? [0, 0, 0]; + const localRot = json.nodes[mpIdx].rotation; + + console.log( + `${name}: Mountpoint localTranslation=(${localTrans.map((v: number) => v.toFixed(4)).join(", ")})` + + (localRot + ? ` localRotation=(${localRot.map((v: number) => v.toFixed(4)).join(", ")})` + : "") + + (worldPos + ? ` worldPos=(${worldPos.map((v) => v.toFixed(4)).join(", ")})` + : ""), + ); + } catch (e: any) { + console.log(`${path.basename(rel, ".glb")}: error - ${e.message}`); + } +} diff --git a/scripts/compute-mount-world.ts b/scripts/compute-mount-world.ts new file mode 100644 index 00000000..53719b2b --- /dev/null +++ b/scripts/compute-mount-world.ts @@ -0,0 +1,200 @@ +/** + * Compute world-space positions of Mount0 and weapon Mountpoint from GLB data, + * then compute the mount transform needed to align them. + */ +import fs from "node:fs/promises"; + +type Vec3 = [number, number, number]; +type Quat = [number, number, number, number]; // [x, y, z, w] + +function rotateVec3(v: Vec3, q: Quat): Vec3 { + const [vx, vy, vz] = v; + const [qx, qy, qz, qw] = q; + // q * v * q^(-1), optimized + const ix = qw * vx + qy * vz - qz * vy; + const iy = qw * vy + qz * vx - qx * vz; + const iz = qw * vz + qx * vy - qy * vx; + const iw = -qx * vx - qy * vy - qz * vz; + return [ + ix * qw + iw * -qx + iy * -qz - iz * -qy, + iy * qw + iw * -qy + iz * -qx - ix * -qz, + iz * qw + iw * -qz + ix * -qy - iy * -qx, + ]; +} + +function multiplyQuat(a: Quat, b: Quat): Quat { + const [ax, ay, az, aw] = a; + const [bx, by, bz, bw] = b; + return [ + aw * bx + ax * bw + ay * bz - az * by, + aw * by - ax * bz + ay * bw + az * bx, + aw * bz + ax * by - ay * bx + az * bw, + aw * bw - ax * bx - ay * by - az * bz, + ]; +} + +function inverseQuat(q: Quat): Quat { + return [-q[0], -q[1], -q[2], q[3]]; +} + +interface GltfNode { + name?: string; + children?: number[]; + translation?: Vec3; + rotation?: Quat; +} + +interface GltfDoc { + nodes: GltfNode[]; + scenes: { nodes: number[] }[]; + scene?: number; +} + +function parseGlb(buffer: Buffer): GltfDoc { + const magic = buffer.readUInt32LE(0); + if (magic !== 0x46546c67) throw new Error("Not GLB"); + const chunk0Length = buffer.readUInt32LE(12); + const jsonStr = buffer.toString("utf-8", 20, 20 + chunk0Length); + return JSON.parse(jsonStr); +} + +function findParent(doc: GltfDoc, nodeIndex: number): number | null { + for (let i = 0; i < doc.nodes.length; i++) { + if (doc.nodes[i].children?.includes(nodeIndex)) return i; + } + return null; +} + +function getAncestorChain(doc: GltfDoc, nodeIndex: number): number[] { + const chain: number[] = []; + let idx: number | null = nodeIndex; + while (idx != null) { + chain.unshift(idx); + idx = findParent(doc, idx); + } + return chain; +} + +function computeWorldTransform( + doc: GltfDoc, + nodeIndex: number, +): { position: Vec3; quaternion: Quat } { + const chain = getAncestorChain(doc, nodeIndex); + let pos: Vec3 = [0, 0, 0]; + let quat: Quat = [0, 0, 0, 1]; + + for (const idx of chain) { + const node = doc.nodes[idx]; + const t: Vec3 = node.translation ?? [0, 0, 0]; + const r: Quat = node.rotation ?? [0, 0, 0, 1]; + + // World = parent * local + // new_pos = parent_pos + rotate(local_pos, parent_quat) + const rotatedT = rotateVec3(t, quat); + pos = [pos[0] + rotatedT[0], pos[1] + rotatedT[1], pos[2] + rotatedT[2]]; + quat = multiplyQuat(quat, r); + } + + return { position: pos, quaternion: quat }; +} + +function findNodeByName(doc: GltfDoc, name: string): number | null { + for (let i = 0; i < doc.nodes.length; i++) { + if (doc.nodes[i].name === name) return i; + } + return null; +} + +function fmt(v: number[]): string { + return `(${v.map((n) => n.toFixed(4)).join(", ")})`; +} + +async function main() { + const playerBuf = await fs.readFile( + "docs/base/@vl2/shapes.vl2/shapes/light_male.glb" + ); + const weaponBuf = await fs.readFile( + "docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb" + ); + + const playerDoc = parseGlb(playerBuf); + const weaponDoc = parseGlb(weaponBuf); + + // Compute Mount0 world transform + const mount0Idx = findNodeByName(playerDoc, "Mount0")!; + const mount0 = computeWorldTransform(playerDoc, mount0Idx); + console.log("Mount0 world position (GLB space):", fmt(mount0.position)); + console.log("Mount0 world rotation (GLB space):", fmt(mount0.quaternion)); + + // Compute Mountpoint world transform + const mpIdx = findNodeByName(weaponDoc, "Mountpoint")!; + const mp = computeWorldTransform(weaponDoc, mpIdx); + console.log("\nMountpoint world position (GLB space):", fmt(mp.position)); + console.log("Mountpoint world rotation (GLB space):", fmt(mp.quaternion)); + + // The ShapeRenderer applies a 90° Y rotation to the GLB scene. + // R90 = quaternion for 90° around Y = (0, sin(45°), 0, cos(45°)) = (0, 0.7071, 0, 0.7071) + const R90: Quat = [0, Math.SQRT1_2, 0, Math.SQRT1_2]; + const R90_inv = inverseQuat(R90); + + // Mount0 in entity space (after ShapeRenderer rotation) + const m0_entity_pos = rotateVec3(mount0.position, R90); + const m0_entity_quat = multiplyQuat(R90, mount0.quaternion); + console.log("\nMount0 entity-space position:", fmt(m0_entity_pos)); + console.log("Mount0 entity-space rotation:", fmt(m0_entity_quat)); + + // The mount transform T_mount must satisfy: + // T_mount * R90 * MP = R90 * M0 + // So: T_mount = R90 * M0 * MP^(-1) * R90^(-1) + // + // For position: mount_pos = R90 * (M0_pos - R_M0 * R_MP^(-1) * MP_pos) + // Wait, let me use the full matrix formula: + // T_mount = R90 * M0 * MP^(-1) * R90^(-1) + + // Step 1: MP^(-1) + const mp_inv_quat = inverseQuat(mp.quaternion); + const mp_inv_pos: Vec3 = rotateVec3( + [-mp.position[0], -mp.position[1], -mp.position[2]], + mp_inv_quat, + ); + + // Step 2: M0 * MP^(-1) + const combined_pos: Vec3 = (() => { + const rotated = rotateVec3(mp_inv_pos, mount0.quaternion); + return [ + mount0.position[0] + rotated[0], + mount0.position[1] + rotated[1], + mount0.position[2] + rotated[2], + ] as Vec3; + })(); + const combined_quat = multiplyQuat(mount0.quaternion, mp_inv_quat); + + // Step 3: R90 * combined * R90^(-1) + const mount_pos = rotateVec3(combined_pos, R90); + // For rotation: R90 * combined_quat * R90^(-1) + const mount_quat = multiplyQuat(multiplyQuat(R90, combined_quat), R90_inv); + + console.log("\n=== CORRECT MOUNT TRANSFORM ==="); + console.log("Position:", fmt(mount_pos)); + console.log("Quaternion:", fmt(mount_quat)); + + // For comparison, show what the current code computes: + // Current: pos = (mount0Pos.z, mount0Pos.y, -mount0Pos.x) + // Current: quat = rot90 * mount0Quat + const current_pos: Vec3 = [ + mount0.position[2], + mount0.position[1], + -mount0.position[0], + ]; + const current_quat = multiplyQuat(R90, mount0.quaternion); + console.log("\n=== CURRENT CODE COMPUTES ==="); + console.log("Position:", fmt(current_pos)); + console.log("Quaternion:", fmt(current_quat)); + + // Show Cam node for reference + const camIdx = findNodeByName(playerDoc, "Cam")!; + const cam = computeWorldTransform(playerDoc, camIdx); + console.log("\nCam world position (GLB space):", fmt(cam.position)); +} + +main().catch(console.error); diff --git a/scripts/inspect-glb-nodes.ts b/scripts/inspect-glb-nodes.ts new file mode 100644 index 00000000..40fb658b --- /dev/null +++ b/scripts/inspect-glb-nodes.ts @@ -0,0 +1,241 @@ +/** + * Inspect nodes in GLB files, showing names, translations, rotations, + * and hierarchy. Useful for finding eye nodes, mount points, etc. + * + * Usage: npx tsx scripts/inspect-glb-nodes.ts [glb-file...] + */ +import fs from "node:fs/promises"; +import path from "node:path"; + +interface GltfNode { + name?: string; + children?: number[]; + translation?: [number, number, number]; + rotation?: [number, number, number, number]; + scale?: [number, number, number]; + mesh?: number; + skin?: number; + camera?: number; + matrix?: number[]; + extras?: Record; +} + +interface GltfSkin { + name?: string; + joints: number[]; + skeleton?: number; + inverseBindMatrices?: number; +} + +interface GltfScene { + name?: string; + nodes?: number[]; +} + +interface GltfDocument { + scenes?: GltfScene[]; + scene?: number; + nodes?: GltfNode[]; + skins?: GltfSkin[]; + meshes?: { name?: string }[]; + animations?: { name?: string; channels?: unknown[] }[]; +} + +function parseGlb(buffer: Buffer): GltfDocument { + // GLB header: magic(4) + version(4) + length(4) + const magic = buffer.readUInt32LE(0); + if (magic !== 0x46546c67) { + throw new Error("Not a valid GLB file"); + } + // First chunk should be JSON + const chunk0Length = buffer.readUInt32LE(12); + const chunk0Type = buffer.readUInt32LE(16); + if (chunk0Type !== 0x4e4f534a) { + throw new Error("Expected JSON chunk"); + } + + const jsonStr = buffer.toString("utf-8", 20, 20 + chunk0Length); + return JSON.parse(jsonStr); +} + +function formatVec3(v: [number, number, number] | undefined): string { + if (!v) return "(0, 0, 0)"; + return `(${v.map((n) => n.toFixed(4)).join(", ")})`; +} + +function formatQuat(q: [number, number, number, number] | undefined): string { + if (!q) return "(0, 0, 0, 1)"; + return `(${q.map((n) => n.toFixed(4)).join(", ")})`; +} + +function printNodeTree( + doc: GltfDocument, + nodeIndex: number, + depth: number, + visited: Set +): void { + if (visited.has(nodeIndex)) return; + visited.add(nodeIndex); + + const node = doc.nodes![nodeIndex]; + const indent = " ".repeat(depth); + const name = node.name || `(unnamed #${nodeIndex})`; + + let extras = ""; + if (node.mesh != null) { + const meshName = doc.meshes?.[node.mesh]?.name; + extras += ` [mesh: ${meshName ?? node.mesh}]`; + } + if (node.skin != null) extras += ` [skin: ${node.skin}]`; + if (node.camera != null) extras += ` [camera: ${node.camera}]`; + + console.log(`${indent}[${nodeIndex}] ${name}${extras}`); + console.log(`${indent} T: ${formatVec3(node.translation)}`); + + // Only show rotation if non-identity + const r = node.rotation; + if (r && (r[0] !== 0 || r[1] !== 0 || r[2] !== 0 || r[3] !== 1)) { + console.log(`${indent} R: ${formatQuat(node.rotation)}`); + } + + // Only show scale if non-identity + const s = node.scale; + if (s && (s[0] !== 1 || s[1] !== 1 || s[2] !== 1)) { + console.log(`${indent} S: ${formatVec3(node.scale as [number, number, number])}`); + } + + // Show matrix if present + if (node.matrix) { + console.log(`${indent} Matrix: [${node.matrix.map((n) => n.toFixed(4)).join(", ")}]`); + } + + if (node.children) { + for (const childIdx of node.children) { + printNodeTree(doc, childIdx, depth + 1, visited); + } + } +} + +async function inspectGlb(filePath: string): Promise { + const absPath = path.resolve(filePath); + console.log(`\n${"=".repeat(80)}`); + console.log(`FILE: ${absPath}`); + console.log(`${"=".repeat(80)}\n`); + + const buffer = await fs.readFile(absPath); + const doc = parseGlb(buffer); + + const nodeCount = doc.nodes?.length ?? 0; + const meshCount = doc.meshes?.length ?? 0; + const skinCount = doc.skins?.length ?? 0; + const animCount = doc.animations?.length ?? 0; + + console.log(`Nodes: ${nodeCount}, Meshes: ${meshCount}, Skins: ${skinCount}, Animations: ${animCount}`); + + // Show skins (skeletons) + if (doc.skins && doc.skins.length > 0) { + console.log(`\n--- Skins ---`); + for (let i = 0; i < doc.skins.length; i++) { + const skin = doc.skins[i]; + console.log(`Skin ${i}: "${skin.name ?? "(unnamed)"}" - ${skin.joints.length} joints`); + console.log(` Root skeleton node: ${skin.skeleton ?? "unset"}`); + console.log( + ` Joint node indices: [${skin.joints.join(", ")}]` + ); + } + } + + // Show animations + if (doc.animations && doc.animations.length > 0) { + console.log(`\n--- Animations ---`); + for (let i = 0; i < doc.animations.length; i++) { + const anim = doc.animations[i]; + console.log(` [${i}] "${anim.name ?? "(unnamed)"}" (${anim.channels?.length ?? 0} channels)`); + } + } + + // Print full node tree + console.log(`\n--- Node Tree ---`); + const visited = new Set(); + + // Start from scene root nodes + const sceneIdx = doc.scene ?? 0; + const scene = doc.scenes?.[sceneIdx]; + if (scene?.nodes) { + for (const rootIdx of scene.nodes) { + printNodeTree(doc, rootIdx, 0, visited); + } + } + + // Print any orphan nodes not reached from scene + if (doc.nodes) { + for (let i = 0; i < doc.nodes.length; i++) { + if (!visited.has(i)) { + console.log(`\n (orphan node not in scene tree:)`); + printNodeTree(doc, i, 1, visited); + } + } + } + + // Highlight interesting nodes + const keywords = ["eye", "mount", "hand", "cam", "head", "weapon", "muzzle", "node", "jet", "contrail"]; + const interesting: { index: number; name: string; node: GltfNode }[] = []; + if (doc.nodes) { + for (let i = 0; i < doc.nodes.length; i++) { + const node = doc.nodes[i]; + const name = (node.name || "").toLowerCase(); + if (keywords.some((kw) => name.includes(kw))) { + interesting.push({ index: i, name: node.name || "", node }); + } + } + } + + if (interesting.length > 0) { + console.log(`\n--- Interesting Nodes (matching: ${keywords.join(", ")}) ---`); + for (const { index, name, node } of interesting) { + console.log(` [${index}] "${name}"`); + console.log(` Translation: ${formatVec3(node.translation)}`); + if (node.rotation) { + console.log(` Rotation: ${formatQuat(node.rotation)}`); + } + if (node.scale) { + console.log(` Scale: ${formatVec3(node.scale as [number, number, number])}`); + } + // Find parent + if (doc.nodes) { + for (let j = 0; j < doc.nodes.length; j++) { + if (doc.nodes[j].children?.includes(index)) { + console.log(` Parent: [${j}] "${doc.nodes[j].name || "(unnamed)"}"`); + break; + } + } + } + } + } + + // Also show a flat list of ALL node names for easy scanning + console.log(`\n--- All Node Names (flat list) ---`); + if (doc.nodes) { + for (let i = 0; i < doc.nodes.length; i++) { + const node = doc.nodes[i]; + console.log(` [${i}] "${node.name || "(unnamed)"}" T:${formatVec3(node.translation)}`); + } + } +} + +// Main +const files = process.argv.slice(2); +if (files.length === 0) { + // Default files to inspect + const defaultFiles = [ + "docs/base/@vl2/shapes.vl2/shapes/light_male.glb", + "docs/base/@vl2/shapes.vl2/shapes/weapon_disc.glb", + ]; + for (const f of defaultFiles) { + await inspectGlb(f); + } +} else { + for (const f of files) { + await inspectGlb(f); + } +} diff --git a/scripts/play-demo.ts b/scripts/play-demo.ts new file mode 100644 index 00000000..f95d24ad --- /dev/null +++ b/scripts/play-demo.ts @@ -0,0 +1,244 @@ +import fs from "node:fs/promises"; +import os from "node:os"; +import path from "node:path"; +import puppeteer from "puppeteer"; +import { parseArgs } from "node:util"; + +function sleep(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +const { values, positionals } = parseArgs({ + options: { + headless: { + type: "boolean", + default: true, + }, + wait: { + type: "string", + default: "10", + short: "w", + }, + screenshot: { + type: "boolean", + default: false, + short: "s", + }, + }, + allowPositionals: true, +}); + +const demoPath = positionals[0]; +const headless = values.headless; +const waitSeconds = parseInt(values.wait!, 10); +const takeScreenshot = values.screenshot; + +if (!demoPath) { + console.error("Usage: npx tsx scripts/play-demo.ts [options] "); + console.error(); + console.error("Options:"); + console.error(" --no-headless Show the browser window"); + console.error(" --wait, -w Seconds to wait after loading (default: 10)"); + console.error(" --screenshot, -s Take a screenshot after loading"); + console.error(); + console.error("Examples:"); + console.error( + " npx tsx scripts/play-demo.ts ~/Projects/t2-demo-parser/demo022.rec", + ); + console.error( + " npx tsx scripts/play-demo.ts --no-headless -w 30 ~/Projects/t2-demo-parser/demo022.rec", + ); + process.exit(1); +} + +const absoluteDemoPath = path.resolve(demoPath); + +const browser = await puppeteer.launch({ headless }); +const page = await browser.newPage(); +await page.setViewport({ width: 900, height: 600 }); + +// Capture all console output from the page, serializing object arguments. +page.on("console", async (msg) => { + const type = msg.type(); + const prefix = + type === "error" ? "ERROR" : type === "warn" ? "WARN" : type.toUpperCase(); + const args = msg.args(); + const parts: string[] = []; + for (const arg of args) { + try { + const val = await arg.jsonValue(); + parts.push(typeof val === "string" ? val : JSON.stringify(val)); + } catch { + parts.push(msg.text()); + break; + } + } + console.log(`[browser ${prefix}] ${parts.join(" ")}`); +}); + +page.on("pageerror", (err: Error) => { + console.error(`[browser EXCEPTION] ${err.message}`); +}); + +// Set up settings before navigating. +await page.evaluateOnNewDocument(() => { + localStorage.setItem( + "settings", + JSON.stringify({ + fov: 80, + audioEnabled: false, + animationEnabled: false, + debugMode: false, + fogEnabled: true, + }), + ); +}); + +const baseUrl = "http://localhost:3000/t2-mapper/"; +console.log(`Loading: ${baseUrl}`); +await page.goto(baseUrl, { waitUntil: "load" }); +await page.waitForNetworkIdle({ idleTime: 500 }); + +// Close any popover by pressing Escape. +await page.keyboard.press("Escape"); +await sleep(100); + +// Hide controls from screenshots. +await page.$eval("#controls", (el: HTMLElement) => { + el.style.visibility = "hidden"; +}); + +// Upload the demo file via the hidden file input. +console.log(`Loading demo: ${absoluteDemoPath}`); +const fileInput = await page.waitForSelector( + 'input[type="file"][accept=".rec"]', +); +if (!fileInput) { + console.error("Could not find demo file input"); + await browser.close(); + process.exit(1); +} +await fileInput.uploadFile(absoluteDemoPath); + +// Wait for the mission to load (demo triggers a mission switch). +console.log("Waiting for mission to load..."); +await sleep(2000); +try { + await page.waitForSelector("#loadingIndicator", { + hidden: true, + timeout: 30000, + }); +} catch { + console.warn( + "Loading indicator did not disappear within 30s, continuing anyway", + ); +} +await page.waitForNetworkIdle({ idleTime: 1000 }); +await sleep(1000); + +// Dismiss any popovers and start playback via JS to avoid triggering UI menus. +await page.evaluate(() => { + // Close any Radix popover by removing it from DOM. + document + .querySelectorAll("[data-radix-popper-content-wrapper]") + .forEach((el) => el.remove()); +}); +await sleep(200); + +// Seek forward if requested via SEEK env var. +const seekTo = process.env.SEEK ? parseFloat(process.env.SEEK) : null; +if (seekTo != null) { + console.log(`Seeking to ${seekTo}s...`); + await page.evaluate((t: number) => { + const input = document.querySelector('input[type="range"]'); + if (input) { + const nativeInputValueSetter = Object.getOwnPropertyDescriptor( + HTMLInputElement.prototype, + "value", + )!.set!; + nativeInputValueSetter.call(input, String(t)); + input.dispatchEvent(new Event("input", { bubbles: true })); + input.dispatchEvent(new Event("change", { bubbles: true })); + } + }, seekTo); + await sleep(500); +} + +// Click play button directly. +await page.evaluate(() => { + const playBtn = document.querySelector('button[aria-label="Play"]'); + if (playBtn) { + (playBtn as HTMLButtonElement).click(); + } +}); +await sleep(500); +console.log("Started playback."); + +console.log(`Demo loaded. Waiting ${waitSeconds}s for console output...`); +await sleep(waitSeconds * 1000); + +// Inspect the Three.js scene for entity groups. +const sceneInfo = await page.evaluate(() => { + const scene = (window as any).__THREE_SCENE__; + if (!scene) return "No scene found (window.__THREE_SCENE__ not set)"; + + const results: string[] = []; + scene.traverse((obj: any) => { + if ( + obj.name && + (obj.name.startsWith("player_") || + obj.name.startsWith("vehicle_") || + obj.name.startsWith("item_") || + obj.name === "camera") + ) { + const pos = obj.position; + const childCount = obj.children?.length ?? 0; + results.push( + `${obj.name}: pos=(${pos.x.toFixed(1)}, ${pos.y.toFixed(1)}, ${pos.z.toFixed(1)}) children=${childCount} visible=${obj.visible}`, + ); + } + }); + + // Check AnimationMixer state. + let mixerInfo = "No mixer found"; + scene.traverse((obj: any) => { + // The root group of DemoPlayback is the direct parent of entity groups. + if (obj.children?.some((c: any) => c.name?.startsWith("player_"))) { + // This is the root group. Check for active animations. + const animations = (obj as any)._mixer; + mixerInfo = `Root group found. Has _mixer: ${!!animations}`; + } + }); + + const entityCount = results.length; + const summary = `Found ${entityCount} entity groups. ${mixerInfo}`; + return [summary, ...results.slice(0, 5)].join("\n"); +}); + +console.log("[scene]", sceneInfo); + +if (takeScreenshot) { + // Remove any popovers that might be covering the canvas. + await page.evaluate(() => { + document + .querySelectorAll("[data-radix-popper-content-wrapper]") + .forEach((el) => el.remove()); + }); + + const canvas = await page.waitForSelector("canvas"); + if (canvas) { + const tempDir = path.join(os.tmpdir(), "t2-mapper"); + await fs.mkdir(tempDir, { recursive: true }); + const demoName = path.basename(absoluteDemoPath, ".rec"); + const date = new Date().toISOString().replace(/([:-]|\..*$)/g, ""); + const outputPath = path.join(tempDir, `${date}.demo.${demoName}.png`); + await canvas.screenshot({ path: outputPath, type: "png" }); + console.log(`Screenshot saved to: ${outputPath}`); + } +} + +console.log("Done."); +await Promise.race([ + browser.close(), + sleep(3000).then(() => browser.process()?.kill("SIGKILL")), +]); diff --git a/src/components/DemoControls.tsx b/src/components/DemoControls.tsx index 7220891d..dbb7639d 100644 --- a/src/components/DemoControls.tsx +++ b/src/components/DemoControls.tsx @@ -1,5 +1,18 @@ import { useCallback, type ChangeEvent } from "react"; -import { useDemo } from "./DemoProvider"; +import { + useDemoActions, + useDemoCurrentTime, + useDemoDuration, + useDemoIsPlaying, + useDemoRecording, + useDemoSpeed, +} from "./DemoProvider"; +import { + buildSerializableDiagnosticsJson, + buildSerializableDiagnosticsSnapshot, + useEngineSelector, + useEngineStoreApi, +} from "../state"; const SPEED_OPTIONS = [0.25, 0.5, 1, 2, 4]; @@ -9,18 +22,41 @@ function formatTime(seconds: number): string { return `${m}:${s.toString().padStart(2, "0")}`; } +function formatBytes(value: number | undefined): string { + if (!Number.isFinite(value) || value == null) { + return "n/a"; + } + if (value < 1024) return `${Math.round(value)} B`; + if (value < 1024 ** 2) return `${(value / 1024).toFixed(1)} KB`; + if (value < 1024 ** 3) return `${(value / 1024 ** 2).toFixed(1)} MB`; + return `${(value / 1024 ** 3).toFixed(2)} GB`; +} + export function DemoControls() { - const { - recording, - isPlaying, - currentTime, - duration, - speed, - play, - pause, - seek, - setSpeed, - } = useDemo(); + const recording = useDemoRecording(); + const isPlaying = useDemoIsPlaying(); + const currentTime = useDemoCurrentTime(); + const duration = useDemoDuration(); + const speed = useDemoSpeed(); + const { play, pause, seek, setSpeed } = useDemoActions(); + const engineStore = useEngineStoreApi(); + const webglContextLost = useEngineSelector( + (state) => state.diagnostics.webglContextLost, + ); + const rendererSampleCount = useEngineSelector( + (state) => state.diagnostics.rendererSamples.length, + ); + const latestRendererSample = useEngineSelector((state) => { + const samples = state.diagnostics.rendererSamples; + return samples.length > 0 ? samples[samples.length - 1] : null; + }); + const playbackEventCount = useEngineSelector( + (state) => state.diagnostics.playbackEvents.length, + ); + const latestPlaybackEvent = useEngineSelector((state) => { + const events = state.diagnostics.playbackEvents; + return events.length > 0 ? events[events.length - 1] : null; + }); const handleSeek = useCallback( (e: ChangeEvent) => { @@ -36,6 +72,19 @@ export function DemoControls() { [setSpeed], ); + const handleDumpDiagnostics = useCallback(() => { + const state = engineStore.getState(); + const snapshot = buildSerializableDiagnosticsSnapshot(state); + const json = buildSerializableDiagnosticsJson(state); + console.log("[demo diagnostics dump]", snapshot); + console.log("[demo diagnostics dump json]", json); + }, [engineStore]); + + const handleClearDiagnostics = useCallback(() => { + engineStore.getState().clearPlaybackDiagnostics(); + console.info("[demo diagnostics] Cleared playback diagnostics"); + }, [engineStore]); + if (!recording) return null; return ( @@ -53,7 +102,7 @@ export function DemoControls() { {isPlaying ? "\u275A\u275A" : "\u25B6"} - {formatTime(currentTime)} / {formatTime(duration)} + {`${formatTime(currentTime)} / ${formatTime(duration)}`} ))} +
+
+ {webglContextLost ? "WebGL context: LOST" : "WebGL context: ok"} +
+
+ {latestRendererSample ? ( + <> + + geom {latestRendererSample.geometries} tex{" "} + {latestRendererSample.textures} prog{" "} + {latestRendererSample.programs} + + + draw {latestRendererSample.renderCalls} tri{" "} + {latestRendererSample.renderTriangles} + + + scene {latestRendererSample.visibleSceneObjects}/ + {latestRendererSample.sceneObjects} + + heap {formatBytes(latestRendererSample.jsHeapUsed)} + + ) : ( + No renderer samples yet + )} +
+
+ + samples {rendererSampleCount} events {playbackEventCount} + + {latestPlaybackEvent ? ( + + last event: {latestPlaybackEvent.kind} + + ) : ( + last event: none + )} + + +
+
); } diff --git a/src/components/DemoPlayback.tsx b/src/components/DemoPlayback.tsx index 3326132d..052b890e 100644 --- a/src/components/DemoPlayback.tsx +++ b/src/components/DemoPlayback.tsx @@ -1,42 +1,102 @@ -import { useEffect, useMemo, useRef } from "react"; -import { useFrame, useThree } from "@react-three/fiber"; import { + Component, + Suspense, + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from "react"; +import type { ErrorInfo, MutableRefObject, ReactNode } from "react"; +import { useFrame, useThree } from "@react-three/fiber"; +import { Html, useGLTF, useTexture } from "@react-three/drei"; +import { + AdditiveBlending, AnimationClip, AnimationMixer, + ClampToEdgeWrapping, + Color, + DoubleSide, Group, + LinearFilter, LoopOnce, + Matrix4, + MeshLambertMaterial, + NoColorSpace, + Object3D, Quaternion, + Raycaster, + SRGBColorSpace, + TextureLoader, Vector3, } from "three"; -import { useDemo } from "./DemoProvider"; +import type { + AnimationAction, + BufferAttribute, + BufferGeometry, + Mesh, + Texture, + MeshStandardMaterial, +} from "three"; +import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js"; +import { useDemoRecording } from "./DemoProvider"; import { createEntityClip } from "../demo/clips"; -import type { DemoEntity } from "../demo/types"; +import { pickMoveAnimation } from "../demo/playerAnimation"; +import { shapeToUrl, textureToUrl } from "../loaders"; +import { TickProvider } from "./TickProvider"; +import { ShapeInfoProvider } from "./ShapeInfoProvider"; +import { FloatingLabel } from "./FloatingLabel"; +import { useDebug } from "./SettingsProvider"; +import { + ShapeRenderer, + useStaticShape, + createMaterialFromFlags, + applyShapeShaderModifications, +} from "./GenericShape"; +import { getHullBoneIndices, filterGeometryByVertexGroups } from "../meshUtils"; +import { setupTexture } from "../textureUtils"; +import type { TorqueObject } from "../torqueScript"; +import type { + DemoEntity, + DemoTracerVisual, + DemoSpriteVisual, + DemoKeyframe, + CameraModeFrame, + DemoRecording, + DemoStreamSnapshot, +} from "../demo/types"; +import { useEngineStoreApi } from "../state"; + +/** Fallback eye height when the player model isn't loaded or has no Cam node. */ +const DEFAULT_EYE_HEIGHT = 2.1; /** * Interpolate camera position and rotation from keyframes at the given time. * Uses linear interpolation for position and slerp for rotation. + * Position is stored in Torque space [x,y,z] and converted to Three.js [y,z,x]. + * Rotation is stored as a Three.js quaternion [x,y,z,w]. */ function interpolateCameraAtTime( entity: DemoEntity, time: number, outPosition: Vector3, outQuaternion: Quaternion, -) { +): number | undefined { const { keyframes } = entity; - if (keyframes.length === 0) return; + if (keyframes.length === 0) return undefined; // Clamp to range if (time <= keyframes[0].time) { const kf = keyframes[0]; outPosition.set(kf.position[1], kf.position[2], kf.position[0]); - setQuaternionFromTorque(kf.rotation, outQuaternion); - return; + outQuaternion.set(...kf.rotation); + return kf.fov; } if (time >= keyframes[keyframes.length - 1].time) { const kf = keyframes[keyframes.length - 1]; outPosition.set(kf.position[1], kf.position[2], kf.position[0]); - setQuaternionFromTorque(kf.rotation, outQuaternion); - return; + outQuaternion.set(...kf.rotation); + return kf.fov; } // Binary search for the bracketing keyframes. @@ -60,42 +120,635 @@ function interpolateCameraAtTime( _tmpVec.set(kfB.position[1], kfB.position[2], kfB.position[0]); outPosition.lerp(_tmpVec, t); - // Slerp rotation. - setQuaternionFromTorque(kfA.rotation, outQuaternion); - setQuaternionFromTorque(kfB.rotation, _tmpQuat); + // Slerp rotation (already in Three.js space). + outQuaternion.set(...kfA.rotation); + _tmpQuat.set(...kfB.rotation); outQuaternion.slerp(_tmpQuat, t); + return kfA.fov ?? kfB.fov; } const _tmpVec = new Vector3(); const _tmpQuat = new Quaternion(); -const _tmpAxis = new Vector3(); +const _interpQuatA = new Quaternion(); +const _interpQuatB = new Quaternion(); +const _orbitDir = new Vector3(); +const _orbitTarget = new Vector3(); +const _orbitCandidate = new Vector3(); +const _hitNormal = new Vector3(); +const _orbitRaycaster = new Raycaster(); +const _tracerDir = new Vector3(); +const _tracerDirFromCam = new Vector3(); +const _tracerCross = new Vector3(); +const _tracerStart = new Vector3(); +const _tracerEnd = new Vector3(); +const _tracerWorldPos = new Vector3(); +const _tracerOrientI = new Vector3(); +const _tracerOrientK = new Vector3(); +const _tracerOrientMat = new Matrix4(); +const _upY = new Vector3(0, 1, 0); -function setQuaternionFromTorque( - rot: [number, number, number, number], - out: Quaternion, -) { - const [ax, ay, az, angleDegrees] = rot; - _tmpAxis.set(ay, az, ax).normalize(); - const angleRadians = -angleDegrees * (Math.PI / 180); - out.setFromAxisAngle(_tmpAxis, angleRadians); +/** ShapeRenderer's 90° Y rotation and its inverse, used for mount transforms. */ +const _r90 = new Quaternion().setFromAxisAngle( + new Vector3(0, 1, 0), + Math.PI / 2, +); +const _r90inv = _r90.clone().invert(); + +/** Torque's animation crossfade duration (seconds). */ +const ANIM_TRANSITION_TIME = 0.25; + +/** + * Torque/Tribes stores camera FOV as horizontal degrees, while Three.js + * PerspectiveCamera.fov expects vertical degrees. + */ +function torqueHorizontalFovToThreeVerticalFov( + torqueFovDeg: number, + aspect: number, +): number { + const safeAspect = Number.isFinite(aspect) && aspect > 0.000001 ? aspect : 4 / 3; + const clampedFov = Math.max(0.01, Math.min(179.99, torqueFovDeg)); + const hRad = (clampedFov * Math.PI) / 180; + const vRad = 2 * Math.atan(Math.tan(hRad / 2) / safeAspect); + return (vRad * 180) / Math.PI; +} + +function setupEffectTexture(tex: Texture): void { + tex.wrapS = ClampToEdgeWrapping; + tex.wrapT = ClampToEdgeWrapping; + tex.minFilter = LinearFilter; + tex.magFilter = LinearFilter; + tex.colorSpace = NoColorSpace; + tex.flipY = false; + tex.needsUpdate = true; +} + +function torqueVecToThree( + v: [number, number, number], + out: Vector3, +): Vector3 { + return out.set(v[1], v[2], v[0]); +} + +function setQuaternionFromDir(dir: Vector3, out: Quaternion): void { + // Equivalent to MathUtils::createOrientFromDir in Torque: + // column1 = direction, with Torque up-vector converted to Three up-vector. + _tracerOrientI.crossVectors(dir, _upY); + if (_tracerOrientI.lengthSq() < 1e-8) { + _tracerOrientI.set(-1, 0, 0); + } + _tracerOrientI.normalize(); + _tracerOrientK.crossVectors(_tracerOrientI, dir).normalize(); + + _tracerOrientMat.set( + _tracerOrientI.x, + dir.x, + _tracerOrientK.x, + 0, + _tracerOrientI.y, + dir.y, + _tracerOrientK.y, + 0, + _tracerOrientI.z, + dir.z, + _tracerOrientK.z, + 0, + 0, + 0, + 0, + 1, + ); + out.setFromRotationMatrix(_tracerOrientMat); +} + +/** Binary search for the keyframe at or before the given time. */ +function getKeyframeAtTime( + keyframes: DemoKeyframe[], + time: number, +): DemoKeyframe | null { + if (keyframes.length === 0) return null; + if (time <= keyframes[0].time) return keyframes[0]; + if (time >= keyframes[keyframes.length - 1].time) + return keyframes[keyframes.length - 1]; + + let lo = 0; + let hi = keyframes.length - 1; + while (hi - lo > 1) { + const mid = (lo + hi) >> 1; + if (keyframes[mid].time <= time) lo = mid; + else hi = mid; + } + return keyframes[lo]; } /** - * R3F component that plays back a demo recording using Three.js AnimationMixer. - * - * Camera entities are interpolated manually each frame (not via the mixer) - * since the camera isn't part of the replay root group. - * - * All other entities get animated via AnimationMixer with clips targeting - * named child groups. + * Clone a shape scene, apply the "Root" idle animation at t=0, and return the + * world-space transform of the named node. This evaluates the skeleton at its + * idle pose rather than using the collapsed bind pose. */ +function getPosedNodeTransform( + scene: Group, + animations: AnimationClip[], + nodeName: string, +): { position: Vector3; quaternion: Quaternion } | null { + const clone = scene.clone(true); + + const rootClip = animations.find((a) => a.name === "Root"); + if (rootClip) { + const mixer = new AnimationMixer(clone); + mixer.clipAction(rootClip).play(); + mixer.setTime(0); + } + + clone.updateMatrixWorld(true); + + let position: Vector3 | null = null; + let quaternion: Quaternion | null = null; + clone.traverse((n) => { + if (!position && n.name === nodeName) { + position = new Vector3(); + quaternion = new Quaternion(); + n.getWorldPosition(position); + n.getWorldQuaternion(quaternion); + } + }); + + if (!position || !quaternion) return null; + return { position, quaternion }; +} + +/** Binary search for the active CameraModeFrame at a given time. */ +function getCameraModeAtTime( + frames: CameraModeFrame[], + time: number, +): CameraModeFrame | null { + if (frames.length === 0) return null; + if (time < frames[0].time) return null; + if (time >= frames[frames.length - 1].time) return frames[frames.length - 1]; + + let lo = 0; + let hi = frames.length - 1; + while (hi - lo > 1) { + const mid = (lo + hi) >> 1; + if (frames[mid].time <= time) { + lo = mid; + } else { + hi = mid; + } + } + return frames[lo]; +} + +function applyEntityLifetimeVisibility( + root: Group, + lifetimes: Map, + time: number, +): void { + for (const child of root.children) { + const lifetime = lifetimes.get(child.name); + if (!lifetime) continue; + child.visible = + time >= lifetime.spawn && + (lifetime.despawn == null || time < lifetime.despawn); + } +} + +/** + * Smooth vertex normals across co-located split vertices (same position, different + * UVs). Matches the technique used by ShapeModel for consistent lighting. + */ +function smoothVertexNormals(geometry: BufferGeometry): void { + geometry.computeVertexNormals(); + + const posAttr = geometry.attributes.position; + const normAttr = geometry.attributes.normal; + if (!posAttr || !normAttr) return; + + const positions = posAttr.array as Float32Array; + const normals = normAttr.array as Float32Array; + + // Build map of position -> vertex indices at that position. + const positionMap = new Map(); + for (let i = 0; i < posAttr.count; i++) { + const key = `${positions[i * 3].toFixed(4)},${positions[i * 3 + 1].toFixed(4)},${positions[i * 3 + 2].toFixed(4)}`; + if (!positionMap.has(key)) { + positionMap.set(key, []); + } + positionMap.get(key)!.push(i); + } + + // Average normals for vertices at the same position. + for (const indices of positionMap.values()) { + if (indices.length > 1) { + let nx = 0, + ny = 0, + nz = 0; + for (const idx of indices) { + nx += normals[idx * 3]; + ny += normals[idx * 3 + 1]; + nz += normals[idx * 3 + 2]; + } + const len = Math.sqrt(nx * nx + ny * ny + nz * nz); + if (len > 0) { + nx /= len; + ny /= len; + nz /= len; + } + for (const idx of indices) { + normals[idx * 3] = nx; + normals[idx * 3 + 1] = ny; + normals[idx * 3 + 2] = nz; + } + } + } + normAttr.needsUpdate = true; +} + +const _textureLoader = new TextureLoader(); + +/** + * Replace a PBR MeshStandardMaterial with a diffuse-only Lambert/Basic material + * matching the Tribes 2 material pipeline. Textures are loaded asynchronously + * from URLs (GLB files don't embed texture data; they store a resource_path in + * material userData instead). + */ +function replaceWithShapeMaterial(mat: MeshStandardMaterial, vis: number) { + const resourcePath: string | undefined = mat.userData?.resource_path; + const flagNames = new Set(mat.userData?.flag_names ?? []); + + if (!resourcePath) { + // No texture path — plain Lambert fallback with fog/lighting shaders. + const fallback = new MeshLambertMaterial({ + color: mat.color, + side: 2, // DoubleSide + reflectivity: 0, + }); + applyShapeShaderModifications(fallback); + return fallback; + } + + // Load texture asynchronously via Three.js TextureLoader. The returned + // Texture is empty initially and gets populated when the image arrives; + // Three.js re-renders automatically once loaded. + const url = textureToUrl(resourcePath); + const texture = _textureLoader.load(url); + setupTexture(texture); + + const result = createMaterialFromFlags(mat, texture, flagNames, false, vis); + // createMaterialFromFlags may return a [back, front] pair for translucent + // materials. Use the front material since we can't split meshes imperatively. + if (Array.isArray(result)) { + return result[1]; + } + return result; +} + +/** + * Post-process a cloned shape scene: hide collision/hull geometry, smooth + * normals, and replace PBR materials with diffuse-only Lambert materials. + */ +function processShapeScene(scene: Object3D): void { + // Find skeleton for hull bone filtering. + let skeleton: any = null; + scene.traverse((n: any) => { + if (!skeleton && n.skeleton) skeleton = n.skeleton; + }); + const hullBoneIndices = skeleton + ? getHullBoneIndices(skeleton) + : new Set(); + + scene.traverse((node: any) => { + if (!node.isMesh) return; + + // Hide unwanted nodes: hull geometry, unassigned materials, invisible objects. + if ( + node.name.match(/^Hulk/i) || + node.material?.name === "Unassigned" || + (node.userData?.vis ?? 1) < 0.01 + ) { + node.visible = false; + return; + } + + // Filter hull-influenced triangles and smooth normals. + if (node.geometry) { + let geometry = filterGeometryByVertexGroups( + node.geometry, + hullBoneIndices, + ); + geometry = geometry.clone(); + smoothVertexNormals(geometry); + node.geometry = geometry; + } + + // Replace PBR materials with diffuse-only Lambert materials. + const vis: number = node.userData?.vis ?? 1; + if (Array.isArray(node.material)) { + node.material = node.material.map((m: MeshStandardMaterial) => + replaceWithShapeMaterial(m, vis), + ); + } else if (node.material) { + node.material = replaceWithShapeMaterial(node.material, vis); + } + }); +} + +function collectSceneObjectCounts(scene: Object3D): { + sceneObjects: number; + visibleSceneObjects: number; +} { + let sceneObjects = 0; + let visibleSceneObjects = 0; + scene.traverse((node) => { + sceneObjects += 1; + if (node.visible) { + visibleSceneObjects += 1; + } + }); + return { sceneObjects, visibleSceneObjects }; +} + +function DemoPlaybackDiagnostics({ recording }: { recording: DemoRecording }) { + const { gl, scene } = useThree(); + const engineStore = useEngineStoreApi(); + const previousSampleRef = useRef<{ + geometries: number; + textures: number; + programs: number; + sceneObjects: number; + visibleSceneObjects: number; + } | null>(null); + const lastSpikeEventMsRef = useRef(0); + + useEffect(() => { + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "recording.loaded", + meta: { + missionName: recording.missionName ?? null, + gameType: recording.gameType ?? null, + isMetadataOnly: !!recording.isMetadataOnly, + isPartial: !!recording.isPartial, + hasStreamingPlayback: !!recording.streamingPlayback, + durationSec: Number(recording.duration.toFixed(3)), + }, + }); + }, [engineStore]); + + useEffect(() => { + const canvas = gl.domElement; + if (!canvas) return; + + const getIsContextLost = () => { + try { + const context = gl.getContext(); + if ( + context && + typeof (context as { isContextLost?: () => boolean }).isContextLost === + "function" + ) { + return !!( + context as { + isContextLost: () => boolean; + } + ).isContextLost(); + } + } catch { + // no-op + } + return undefined; + }; + + const handleContextLost = (event: Event) => { + event.preventDefault(); + const store = engineStore.getState(); + store.setWebglContextLost(true); + store.recordPlaybackDiagnosticEvent({ + kind: "webgl.context.lost", + message: "Renderer emitted webglcontextlost", + meta: { + contextLost: getIsContextLost(), + }, + }); + console.error("[demo diagnostics] WebGL context lost"); + }; + + const handleContextRestored = () => { + const store = engineStore.getState(); + store.setWebglContextLost(false); + store.recordPlaybackDiagnosticEvent({ + kind: "webgl.context.restored", + message: "Renderer emitted webglcontextrestored", + meta: { + contextLost: getIsContextLost(), + }, + }); + console.warn("[demo diagnostics] WebGL context restored"); + }; + + const handleContextCreationError = (event: Event) => { + const contextEvent = event as Event & { statusMessage?: string }; + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "webgl.context.creation_error", + message: contextEvent.statusMessage ?? "Context creation error", + meta: { + contextLost: getIsContextLost(), + }, + }); + console.error( + "[demo diagnostics] WebGL context creation error", + contextEvent.statusMessage ?? "", + ); + }; + + canvas.addEventListener("webglcontextlost", handleContextLost, false); + canvas.addEventListener("webglcontextrestored", handleContextRestored, false); + canvas.addEventListener( + "webglcontextcreationerror", + handleContextCreationError, + false, + ); + + return () => { + canvas.removeEventListener("webglcontextlost", handleContextLost, false); + canvas.removeEventListener( + "webglcontextrestored", + handleContextRestored, + false, + ); + canvas.removeEventListener( + "webglcontextcreationerror", + handleContextCreationError, + false, + ); + }; + }, [engineStore, gl]); + + useEffect(() => { + const collectSample = () => { + const { sceneObjects, visibleSceneObjects } = collectSceneObjectCounts(scene); + const programs = Array.isArray((gl.info as any).programs) + ? (gl.info as any).programs.length + : 0; + const perfMemory = (performance as any).memory as + | { + usedJSHeapSize?: number; + totalJSHeapSize?: number; + jsHeapSizeLimit?: number; + } + | undefined; + const nextSample = { + t: Date.now(), + geometries: gl.info.memory.geometries, + textures: gl.info.memory.textures, + programs, + renderCalls: gl.info.render.calls, + renderTriangles: gl.info.render.triangles, + renderPoints: gl.info.render.points, + renderLines: gl.info.render.lines, + sceneObjects, + visibleSceneObjects, + jsHeapUsed: perfMemory?.usedJSHeapSize, + jsHeapTotal: perfMemory?.totalJSHeapSize, + jsHeapLimit: perfMemory?.jsHeapSizeLimit, + }; + engineStore.getState().appendRendererSample(nextSample); + + const previous = previousSampleRef.current; + previousSampleRef.current = { + geometries: nextSample.geometries, + textures: nextSample.textures, + programs: nextSample.programs, + sceneObjects: nextSample.sceneObjects, + visibleSceneObjects: nextSample.visibleSceneObjects, + }; + if (!previous) { + return; + } + + const now = nextSample.t; + const geometryDelta = nextSample.geometries - previous.geometries; + const textureDelta = nextSample.textures - previous.textures; + const programDelta = nextSample.programs - previous.programs; + const sceneObjectDelta = nextSample.sceneObjects - previous.sceneObjects; + + if ( + now - lastSpikeEventMsRef.current >= 5000 && + (geometryDelta >= 200 || + textureDelta >= 100 || + programDelta >= 20 || + sceneObjectDelta >= 400) + ) { + lastSpikeEventMsRef.current = now; + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "renderer.resource.spike", + message: "Detected large one-second renderer resource increase", + meta: { + geometryDelta, + textureDelta, + programDelta, + sceneObjectDelta, + geometries: nextSample.geometries, + textures: nextSample.textures, + programs: nextSample.programs, + sceneObjects: nextSample.sceneObjects, + }, + }); + } + }; + + collectSample(); + const intervalId = window.setInterval(collectSample, 1000); + return () => { + window.clearInterval(intervalId); + }; + }, [engineStore, gl, scene]); + + return null; +} + export function DemoPlayback() { - const { recording, playbackRef } = useDemo(); - const { camera } = useThree(); + const engineStore = useEngineStoreApi(); + const recording = useDemoRecording(); + const instanceIdRef = useRef(null); + if (!instanceIdRef.current) { + instanceIdRef.current = nextLifecycleInstanceId("DemoPlayback"); + } + + useEffect(() => { + demoPlaybackMountCount += 1; + const mountedAt = Date.now(); + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "component.lifecycle", + message: "DemoPlayback mounted", + meta: { + component: "DemoPlayback", + phase: "mount", + instanceId: instanceIdRef.current, + mountCount: demoPlaybackMountCount, + unmountCount: demoPlaybackUnmountCount, + recordingMissionName: recording?.missionName ?? null, + recordingDurationSec: recording + ? Number(recording.duration.toFixed(3)) + : null, + ts: mountedAt, + }, + }); + console.info("[demo diagnostics] DemoPlayback mounted", { + instanceId: instanceIdRef.current, + mountCount: demoPlaybackMountCount, + unmountCount: demoPlaybackUnmountCount, + recordingMissionName: recording?.missionName ?? null, + mountedAt, + }); + + return () => { + demoPlaybackUnmountCount += 1; + const unmountedAt = Date.now(); + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "component.lifecycle", + message: "DemoPlayback unmounted", + meta: { + component: "DemoPlayback", + phase: "unmount", + instanceId: instanceIdRef.current, + mountCount: demoPlaybackMountCount, + unmountCount: demoPlaybackUnmountCount, + recordingMissionName: recording?.missionName ?? null, + ts: unmountedAt, + }, + }); + console.info("[demo diagnostics] DemoPlayback unmounted", { + instanceId: instanceIdRef.current, + mountCount: demoPlaybackMountCount, + unmountCount: demoPlaybackUnmountCount, + recordingMissionName: recording?.missionName ?? null, + unmountedAt, + }); + }; + }, [engineStore]); + + if (!recording) return null; + return ( + <> + + {recording.isMetadataOnly || recording.isPartial ? ( + + ) : ( + + )} + + ); +} + +/** + * R3F component that plays back a fully prebuilt recording using + * Three.js AnimationMixer clips. + */ +function FullDemoPlayback({ recording }: { recording: DemoRecording }) { + const engineStore = useEngineStoreApi(); const rootRef = useRef(null); const mixerRef = useRef(null); const timeRef = useRef(0); - const lastSyncRef = useRef(0); + const eyeOffsetRef = useRef(new Vector3(0, DEFAULT_EYE_HEIGHT, 0)); // Identify the camera entity and non-camera entities. const { cameraEntity, otherEntities } = useMemo(() => { @@ -114,6 +767,34 @@ export function DemoPlayback() { return map; }, [otherEntities]); + // Build a lookup of spawn/despawn windows for visibility toggling. + const entityLifetimes = useMemo(() => { + const map = new Map(); + for (const entity of otherEntities) { + map.set(String(entity.id), { + spawn: entity.spawnTime ?? 0, + despawn: entity.despawnTime, + }); + } + return map; + }, [otherEntities]); + + // Resolve the first-person player's shape name so we can extract the + // eye offset from its Eye node at render time. + const firstPersonShape = useMemo(() => { + if (!recording) return null; + const entityShapes = new Map(); + for (const e of otherEntities) { + if (e.dataBlock) entityShapes.set(String(e.id), e.dataBlock); + } + for (const frame of recording.cameraModes) { + if (frame.mode === "first-person" && frame.controlEntityId) { + return entityShapes.get(frame.controlEntityId) ?? null; + } + } + return null; + }, [recording, otherEntities]); + // Set up the mixer and actions when recording/clips change. useEffect(() => { const root = rootRef.current; @@ -132,6 +813,10 @@ export function DemoPlayback() { action.play(); } + // Evaluate time 0 so entities show their initial keyframe positions + // even before playback starts. + mixer.setTime(0); + // Start paused — useFrame will unpause based on playback state. mixer.timeScale = 0; @@ -141,36 +826,42 @@ export function DemoPlayback() { }; }, [entityClips]); - // Drive playback each frame. - useFrame((_state, delta) => { - const pb = playbackRef.current; - const mixer = mixerRef.current; - - // Handle pending seek. - if (pb.pendingSeek != null) { - timeRef.current = pb.pendingSeek; - if (mixer) { - mixer.setTime(pb.pendingSeek); - } - pb.pendingSeek = null; + // Keep local playback cursor aligned with store-driven seeks/resets. + useEffect(() => { + const playback = engineStore.getState().playback; + timeRef.current = playback.timeMs / 1000; + if (mixerRef.current) { + mixerRef.current.setTime(timeRef.current); } + }, [engineStore]); - // Handle pending play/pause state change. - if (pb.pendingPlayState != null) { - pb.isPlaying = pb.pendingPlayState; - pb.pendingPlayState = null; + // Drive playback each frame. + useFrame((state, delta) => { + const sceneCamera = state.camera; + const storeState = engineStore.getState(); + const playback = storeState.playback; + const mixer = mixerRef.current; + const status = playback.status; + const speed = playback.rate; + const requestedTimeSec = playback.timeMs / 1000; + + // Handle external seeks (scrubber/programmatic updates). + if (Math.abs(requestedTimeSec - timeRef.current) > 0.0005) { + timeRef.current = requestedTimeSec; + if (mixer) { + mixer.setTime(requestedTimeSec); + } } // Advance time if playing. - if (pb.isPlaying && recording) { - const advance = delta * pb.speed; + if (status === "playing" && recording) { + const advance = delta * speed; timeRef.current += advance; // Clamp to duration; stop at end. if (timeRef.current >= recording.duration) { timeRef.current = recording.duration; - pb.isPlaying = false; - (pb as any).updateCurrentTime?.(timeRef.current); + storeState.setPlaybackStatus("paused"); } if (mixer) { @@ -183,52 +874,1414 @@ export function DemoPlayback() { // Interpolate camera. if (cameraEntity && cameraEntity.keyframes.length > 0) { - interpolateCameraAtTime( + const fov = interpolateCameraAtTime( cameraEntity, timeRef.current, - camera.position, - camera.quaternion, + sceneCamera.position, + sceneCamera.quaternion, + ); + if ( + typeof fov === "number" && + Number.isFinite(fov) && + "isPerspectiveCamera" in sceneCamera && + (sceneCamera as any).isPerspectiveCamera + ) { + const perspectiveCamera = sceneCamera as any; + const verticalFov = torqueHorizontalFovToThreeVerticalFov( + fov, + perspectiveCamera.aspect, + ); + if (Math.abs(perspectiveCamera.fov - verticalFov) > 0.01) { + perspectiveCamera.fov = verticalFov; + perspectiveCamera.updateProjectionMatrix(); + } + } + } + + // Determine current camera mode. + const frame = recording + ? getCameraModeAtTime(recording.cameraModes, timeRef.current) + : null; + + // In first-person mode, the camera keyframes store the player's foot + // position. Offset up to eye level using the Eye node from the player's + // loaded shape (or the default fallback), matching Player::getEyeTransform() + // which multiplies the eye node position by the entity transform (body yaw). + if (frame?.mode === "first-person" && rootRef.current) { + const playerGroup = rootRef.current.children.find( + (c) => c.name === frame.controlEntityId, + ); + if (playerGroup) { + _tmpVec + .copy(eyeOffsetRef.current) + .applyQuaternion(playerGroup.quaternion); + sceneCamera.position.add(_tmpVec); + } else { + sceneCamera.position.y += eyeOffsetRef.current.y; + } + } + + // Toggle entity visibility based on lifecycle windows. + if (rootRef.current && entityLifetimes.size > 0) { + applyEntityLifetimeVisibility( + rootRef.current, + entityLifetimes, + timeRef.current, ); } - // Throttle syncing current time to React state (~10 Hz). - const now = performance.now(); - if (pb.isPlaying && now - lastSyncRef.current > 100) { - lastSyncRef.current = now; - pb.currentTime = timeRef.current; - (pb as any).updateCurrentTime?.(timeRef.current); + // Keep the store cursor synced with the animation clock. + const timeMs = timeRef.current * 1000; + if (Math.abs(timeMs - playback.timeMs) > 0.5) { + storeState.setPlaybackTime(timeMs); } }); - if (!recording) return null; + return ( + + + {otherEntities.map((entity) => ( + + ))} + + {firstPersonShape && ( + + + + )} + + ); +} + +function streamSnapshotSignature(snapshot: DemoStreamSnapshot): string { + const parts: string[] = []; + for (const entity of snapshot.entities) { + const visualPart = + entity.visual?.kind === "tracer" + ? `tracer:${entity.visual.texture}:${entity.visual.crossTexture ?? ""}:${entity.visual.tracerLength}:${entity.visual.tracerWidth}:${entity.visual.crossViewAng}:${entity.visual.crossSize}:${entity.visual.renderCross ? 1 : 0}` + : entity.visual?.kind === "sprite" + ? `sprite:${entity.visual.texture}:${entity.visual.color.r}:${entity.visual.color.g}:${entity.visual.color.b}:${entity.visual.size}` + : ""; + parts.push( + `${entity.id}|${entity.type}|${entity.dataBlock ?? ""}|${entity.weaponShape ?? ""}|${entity.playerName ?? ""}|${entity.className ?? ""}|${entity.ghostIndex ?? ""}|${entity.dataBlockId ?? ""}|${entity.shapeHint ?? ""}|${entity.faceViewer ? "fv" : ""}|${visualPart}`, + ); + } + parts.sort(); + return parts.join(";"); +} + +function buildStreamDemoEntity( + id: string, + type: string, + dataBlock: string | undefined, + visual: DemoEntity["visual"] | undefined, + direction: DemoEntity["direction"] | undefined, + weaponShape: string | undefined, + playerName: string | undefined, + className: string | undefined, + ghostIndex: number | undefined, + dataBlockId: number | undefined, + shapeHint: string | undefined, +): DemoEntity { + return { + id, + type, + dataBlock, + visual, + direction, + weaponShape, + playerName, + className, + ghostIndex, + dataBlockId, + shapeHint, + keyframes: [ + { + time: 0, + position: [0, 0, 0], + rotation: [0, 0, 0, 1], + }, + ], + }; +} + +const STREAM_TICK_MS = 32; +const STREAM_TICK_SEC = STREAM_TICK_MS / 1000; +const CAMERA_COLLISION_RADIUS = 0.05; +let demoPlaybackMountCount = 0; +let demoPlaybackUnmountCount = 0; +let streamingDemoPlaybackMountCount = 0; +let streamingDemoPlaybackUnmountCount = 0; +let lifecycleInstanceIdSeed = 0; + +function nextLifecycleInstanceId(prefix: string): string { + lifecycleInstanceIdSeed += 1; + return `${prefix}-${lifecycleInstanceIdSeed}`; +} + +function hasAncestorNamed(object: Object3D | null, name: string): boolean { + let node: Object3D | null = object; + while (node) { + if (node.name === name) return true; + node = node.parent; + } + return false; +} + +function StreamingDemoPlayback({ recording }: { recording: DemoRecording }) { + const engineStore = useEngineStoreApi(); + const instanceIdRef = useRef(null); + if (!instanceIdRef.current) { + instanceIdRef.current = nextLifecycleInstanceId("StreamingDemoPlayback"); + } + const rootRef = useRef(null); + const timeRef = useRef(0); + const playbackClockRef = useRef(0); + const prevTickSnapshotRef = useRef(null); + const currentTickSnapshotRef = useRef(null); + const eyeOffsetRef = useRef(new Vector3(0, DEFAULT_EYE_HEIGHT, 0)); + const streamRef = useRef(recording.streamingPlayback ?? null); + const publishedSnapshotRef = useRef(null); + const entitySignatureRef = useRef(""); + const entityMapRef = useRef>(new Map()); + const lastEntityRebuildEventMsRef = useRef(0); + const exhaustedEventLoggedRef = useRef(false); + const [entities, setEntities] = useState([]); + const [firstPersonShape, setFirstPersonShape] = useState(null); + + useEffect(() => { + streamingDemoPlaybackMountCount += 1; + const mountedAt = Date.now(); + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "component.lifecycle", + message: "StreamingDemoPlayback mounted", + meta: { + component: "StreamingDemoPlayback", + phase: "mount", + instanceId: instanceIdRef.current, + mountCount: streamingDemoPlaybackMountCount, + unmountCount: streamingDemoPlaybackUnmountCount, + recordingMissionName: recording.missionName ?? null, + recordingDurationSec: Number(recording.duration.toFixed(3)), + ts: mountedAt, + }, + }); + console.info("[demo diagnostics] StreamingDemoPlayback mounted", { + instanceId: instanceIdRef.current, + mountCount: streamingDemoPlaybackMountCount, + unmountCount: streamingDemoPlaybackUnmountCount, + recordingMissionName: recording.missionName ?? null, + mountedAt, + }); + + return () => { + streamingDemoPlaybackUnmountCount += 1; + const unmountedAt = Date.now(); + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "component.lifecycle", + message: "StreamingDemoPlayback unmounted", + meta: { + component: "StreamingDemoPlayback", + phase: "unmount", + instanceId: instanceIdRef.current, + mountCount: streamingDemoPlaybackMountCount, + unmountCount: streamingDemoPlaybackUnmountCount, + recordingMissionName: recording.missionName ?? null, + ts: unmountedAt, + }, + }); + console.info("[demo diagnostics] StreamingDemoPlayback unmounted", { + instanceId: instanceIdRef.current, + mountCount: streamingDemoPlaybackMountCount, + unmountCount: streamingDemoPlaybackUnmountCount, + recordingMissionName: recording.missionName ?? null, + unmountedAt, + }); + }; + }, [engineStore]); + + const syncRenderableEntities = useCallback((snapshot: DemoStreamSnapshot) => { + const previousEntityCount = entityMapRef.current.size; + const nextSignature = streamSnapshotSignature(snapshot); + const shouldRebuild = entitySignatureRef.current !== nextSignature; + const nextMap = new Map(); + + for (const entity of snapshot.entities) { + let renderEntity = entityMapRef.current.get(entity.id); + if ( + !renderEntity || + renderEntity.type !== entity.type || + renderEntity.dataBlock !== entity.dataBlock || + renderEntity.weaponShape !== entity.weaponShape || + renderEntity.className !== entity.className || + renderEntity.ghostIndex !== entity.ghostIndex || + renderEntity.dataBlockId !== entity.dataBlockId || + renderEntity.shapeHint !== entity.shapeHint + ) { + renderEntity = buildStreamDemoEntity( + entity.id, + entity.type, + entity.dataBlock, + entity.visual, + entity.direction, + entity.weaponShape, + entity.playerName, + entity.className, + entity.ghostIndex, + entity.dataBlockId, + entity.shapeHint, + ); + } + + renderEntity.playerName = entity.playerName; + renderEntity.iffColor = entity.iffColor; + renderEntity.dataBlock = entity.dataBlock; + renderEntity.visual = entity.visual; + renderEntity.direction = entity.direction; + renderEntity.weaponShape = entity.weaponShape; + renderEntity.className = entity.className; + renderEntity.ghostIndex = entity.ghostIndex; + renderEntity.dataBlockId = entity.dataBlockId; + renderEntity.shapeHint = entity.shapeHint; + + if (renderEntity.keyframes.length === 0) { + renderEntity.keyframes.push({ + time: snapshot.timeSec, + position: entity.position ?? [0, 0, 0], + rotation: entity.rotation ?? [0, 0, 0, 1], + }); + } + + const kf = renderEntity.keyframes[0]; + kf.time = snapshot.timeSec; + if (entity.position) kf.position = entity.position; + if (entity.rotation) kf.rotation = entity.rotation; + kf.velocity = entity.velocity; + kf.health = entity.health; + kf.energy = entity.energy; + + nextMap.set(entity.id, renderEntity); + } + + entityMapRef.current = nextMap; + if (shouldRebuild) { + entitySignatureRef.current = nextSignature; + setEntities(Array.from(nextMap.values())); + const now = Date.now(); + if (now - lastEntityRebuildEventMsRef.current >= 500) { + lastEntityRebuildEventMsRef.current = now; + engineStore.getState().recordPlaybackDiagnosticEvent({ + kind: "stream.entities.rebuild", + message: "Renderable demo entity list was rebuilt", + meta: { + previousEntityCount, + nextEntityCount: nextMap.size, + snapshotTimeSec: Number(snapshot.timeSec.toFixed(3)), + }, + }); + } + } + + let nextFirstPersonShape: string | null = null; + if (snapshot.camera?.mode === "first-person" && snapshot.camera.controlEntityId) { + const entity = nextMap.get(snapshot.camera.controlEntityId); + if (entity?.dataBlock) { + nextFirstPersonShape = entity.dataBlock; + } + } + setFirstPersonShape((prev) => + prev === nextFirstPersonShape ? prev : nextFirstPersonShape, + ); + }, [engineStore]); + + useEffect(() => { + streamRef.current = recording.streamingPlayback ?? null; + entityMapRef.current = new Map(); + entitySignatureRef.current = ""; + publishedSnapshotRef.current = null; + timeRef.current = 0; + playbackClockRef.current = 0; + prevTickSnapshotRef.current = null; + currentTickSnapshotRef.current = null; + exhaustedEventLoggedRef.current = false; + + const stream = streamRef.current; + if (!stream) { + engineStore.getState().setPlaybackStreamSnapshot(null); + return; + } + + stream.reset(); + // Preload weapon effect shapes (explosions) so they're cached before + // the first projectile detonates — otherwise the GLB fetch latency + // causes the short-lived explosion entity to expire before it renders. + for (const shape of stream.getEffectShapes()) { + useGLTF.preload(shapeToUrl(shape)); + } + const snapshot = stream.getSnapshot(); + timeRef.current = snapshot.timeSec; + playbackClockRef.current = snapshot.timeSec; + prevTickSnapshotRef.current = snapshot; + currentTickSnapshotRef.current = snapshot; + syncRenderableEntities(snapshot); + engineStore.getState().setPlaybackStreamSnapshot(snapshot); + publishedSnapshotRef.current = snapshot; + + return () => { + engineStore.getState().setPlaybackStreamSnapshot(null); + }; + }, [recording, engineStore, syncRenderableEntities]); + + useFrame((state, delta) => { + const stream = streamRef.current; + if (!stream) return; + + const storeState = engineStore.getState(); + const playback = storeState.playback; + const isPlaying = playback.status === "playing"; + const requestedTimeSec = playback.timeMs / 1000; + const externalSeekWhilePaused = + !isPlaying && Math.abs(requestedTimeSec - playbackClockRef.current) > 0.0005; + const externalSeekWhilePlaying = + isPlaying && Math.abs(requestedTimeSec - timeRef.current) > 0.05; + const isSeeking = externalSeekWhilePaused || externalSeekWhilePlaying; + if (isSeeking) { + // Sync stream cursor to UI/programmatic seek. + playbackClockRef.current = requestedTimeSec; + } + + if (isPlaying) { + playbackClockRef.current += delta * playback.rate; + } + + const moveTicksNeeded = Math.max( + 1, + Math.ceil((delta * 1000 * Math.max(playback.rate, 0.01)) / 32) + 2, + ); + + // Torque interpolates backwards from the end of the current 32ms tick. + // We sample one tick ahead and blend previous->current for smooth render. + const sampleTimeSec = playbackClockRef.current + STREAM_TICK_SEC; + // During a seek, process all ticks to the target immediately so the world + // state is fully reconstructed. The per-frame tick limit only applies + // during normal playback advancement. + const snapshot = stream.stepToTime( + sampleTimeSec, + isPlaying && !isSeeking ? moveTicksNeeded : Number.POSITIVE_INFINITY, + ); + + const currentTick = currentTickSnapshotRef.current; + if ( + !currentTick || + snapshot.timeSec < currentTick.timeSec || + snapshot.timeSec - currentTick.timeSec > STREAM_TICK_SEC * 1.5 + ) { + prevTickSnapshotRef.current = snapshot; + currentTickSnapshotRef.current = snapshot; + } else if (snapshot.timeSec !== currentTick.timeSec) { + prevTickSnapshotRef.current = currentTick; + currentTickSnapshotRef.current = snapshot; + } + + const renderCurrent = currentTickSnapshotRef.current ?? snapshot; + const renderPrev = prevTickSnapshotRef.current ?? renderCurrent; + const tickStartTime = renderCurrent.timeSec - STREAM_TICK_SEC; + const interpT = Math.max( + 0, + Math.min(1, (playbackClockRef.current - tickStartTime) / STREAM_TICK_SEC), + ); + + timeRef.current = playbackClockRef.current; + if (snapshot.exhausted && isPlaying) { + playbackClockRef.current = Math.min(playbackClockRef.current, snapshot.timeSec); + } + syncRenderableEntities(renderCurrent); + + const publishedSnapshot = publishedSnapshotRef.current; + const shouldPublish = + !publishedSnapshot || + renderCurrent.timeSec !== publishedSnapshot.timeSec || + renderCurrent.exhausted !== publishedSnapshot.exhausted || + renderCurrent.status.health !== publishedSnapshot.status.health || + renderCurrent.status.energy !== publishedSnapshot.status.energy || + renderCurrent.camera?.mode !== publishedSnapshot.camera?.mode || + renderCurrent.camera?.controlEntityId !== + publishedSnapshot.camera?.controlEntityId || + renderCurrent.camera?.orbitTargetId !== + publishedSnapshot.camera?.orbitTargetId; + + if (shouldPublish) { + publishedSnapshotRef.current = renderCurrent; + storeState.setPlaybackStreamSnapshot(renderCurrent); + } + + const currentCamera = renderCurrent.camera; + const previousCamera = + currentCamera && + renderPrev.camera && + renderPrev.camera.mode === currentCamera.mode && + renderPrev.camera.controlEntityId === currentCamera.controlEntityId && + renderPrev.camera.orbitTargetId === currentCamera.orbitTargetId + ? renderPrev.camera + : null; + + if (currentCamera) { + if (previousCamera) { + const px = previousCamera.position[0]; + const py = previousCamera.position[1]; + const pz = previousCamera.position[2]; + const cx = currentCamera.position[0]; + const cy = currentCamera.position[1]; + const cz = currentCamera.position[2]; + const ix = px + (cx - px) * interpT; + const iy = py + (cy - py) * interpT; + const iz = pz + (cz - pz) * interpT; + state.camera.position.set(iy, iz, ix); + + _interpQuatA.set(...previousCamera.rotation); + _interpQuatB.set(...currentCamera.rotation); + _interpQuatA.slerp(_interpQuatB, interpT); + state.camera.quaternion.copy(_interpQuatA); + } else { + state.camera.position.set( + currentCamera.position[1], + currentCamera.position[2], + currentCamera.position[0], + ); + state.camera.quaternion.set(...currentCamera.rotation); + } + + if ( + Number.isFinite(currentCamera.fov) && + "isPerspectiveCamera" in state.camera && + (state.camera as any).isPerspectiveCamera + ) { + const perspectiveCamera = state.camera as any; + const fovValue = + previousCamera && Number.isFinite(previousCamera.fov) + ? previousCamera.fov + (currentCamera.fov - previousCamera.fov) * interpT + : currentCamera.fov; + const verticalFov = torqueHorizontalFovToThreeVerticalFov( + fovValue, + perspectiveCamera.aspect, + ); + if (Math.abs(perspectiveCamera.fov - verticalFov) > 0.01) { + perspectiveCamera.fov = verticalFov; + perspectiveCamera.updateProjectionMatrix(); + } + } + } + + const currentEntities = new Map(renderCurrent.entities.map((e) => [e.id, e])); + const previousEntities = new Map(renderPrev.entities.map((e) => [e.id, e])); + const root = rootRef.current; + if (root) { + for (const child of root.children) { + const entity = currentEntities.get(child.name); + if (!entity?.position) { + child.visible = false; + continue; + } + + child.visible = true; + const previousEntity = previousEntities.get(child.name); + if (previousEntity?.position) { + const px = previousEntity.position[0]; + const py = previousEntity.position[1]; + const pz = previousEntity.position[2]; + const cx = entity.position[0]; + const cy = entity.position[1]; + const cz = entity.position[2]; + const ix = px + (cx - px) * interpT; + const iy = py + (cy - py) * interpT; + const iz = pz + (cz - pz) * interpT; + child.position.set(iy, iz, ix); + } else { + child.position.set(entity.position[1], entity.position[2], entity.position[0]); + } + + if (entity.faceViewer) { + child.quaternion.copy(state.camera.quaternion); + } else if (entity.visual?.kind === "tracer") { + child.quaternion.identity(); + } else if (entity.rotation) { + if (previousEntity?.rotation) { + _interpQuatA.set(...previousEntity.rotation); + _interpQuatB.set(...entity.rotation); + _interpQuatA.slerp(_interpQuatB, interpT); + child.quaternion.copy(_interpQuatA); + } else { + child.quaternion.set(...entity.rotation); + } + } + } + } + + const mode = currentCamera?.mode; + if (mode === "third-person" && root && currentCamera?.orbitTargetId) { + const targetGroup = root.children.find( + (child) => child.name === currentCamera.orbitTargetId, + ); + if (targetGroup) { + const orbitEntity = currentEntities.get(currentCamera.orbitTargetId); + _orbitTarget.copy(targetGroup.position); + // Torque orbits the target's render world-box center; player positions + // in our stream are feet-level, so lift to an approximate center. + if (orbitEntity?.type === "Player") { + _orbitTarget.y += 1.0; + } + + let hasDirection = false; + if ( + typeof currentCamera.yaw === "number" && + typeof currentCamera.pitch === "number" + ) { + const sx = Math.sin(currentCamera.pitch); + const cx = Math.cos(currentCamera.pitch); + const sz = Math.sin(currentCamera.yaw); + const cz = Math.cos(currentCamera.yaw); + // Camera::validateEyePoint uses Camera::setPosition's column1 in + // Torque space as the orbit pull-back direction. Converted to Three, + // that target->camera vector is (-cx, -sz*sx, -cz*sx). + _orbitDir.set(-cx, -sz * sx, -cz * sx); + hasDirection = _orbitDir.lengthSq() > 1e-8; + } + if (!hasDirection) { + _orbitDir.copy(state.camera.position).sub(_orbitTarget); + hasDirection = _orbitDir.lengthSq() > 1e-8; + } + if (hasDirection) { + _orbitDir.normalize(); + const orbitDistance = Math.max(0.1, currentCamera.orbitDistance ?? 4); + _orbitCandidate.copy(_orbitTarget).addScaledVector(_orbitDir, orbitDistance); + + // Mirror Camera::validateEyePoint: cast 2.5x desired distance toward + // the candidate and pull in if an obstacle blocks the orbit. + _orbitRaycaster.near = 0.001; + _orbitRaycaster.far = orbitDistance * 2.5; + _orbitRaycaster.camera = state.camera; + _orbitRaycaster.set(_orbitTarget, _orbitDir); + const hits = _orbitRaycaster.intersectObjects(state.scene.children, true); + for (const hit of hits) { + if (hit.distance <= 0.0001) continue; + if (hasAncestorNamed(hit.object, currentCamera.orbitTargetId)) continue; + if (!hit.face) break; + + _hitNormal.copy(hit.face.normal).transformDirection(hit.object.matrixWorld); + const dot = -_orbitDir.dot(_hitNormal); + if (dot > 0.01) { + let colDist = hit.distance - CAMERA_COLLISION_RADIUS / dot; + if (colDist > orbitDistance) colDist = orbitDistance; + if (colDist < 0) colDist = 0; + _orbitCandidate + .copy(_orbitTarget) + .addScaledVector(_orbitDir, colDist); + } + break; + } + + state.camera.position.copy(_orbitCandidate); + state.camera.lookAt(_orbitTarget); + } + } + } + + if (mode === "first-person" && root && currentCamera?.controlEntityId) { + const playerGroup = root.children.find( + (child) => child.name === currentCamera.controlEntityId, + ); + if (playerGroup) { + _tmpVec.copy(eyeOffsetRef.current).applyQuaternion(playerGroup.quaternion); + state.camera.position.add(_tmpVec); + } else { + state.camera.position.y += eyeOffsetRef.current.y; + } + } + + if (isPlaying && snapshot.exhausted) { + if (!exhaustedEventLoggedRef.current) { + exhaustedEventLoggedRef.current = true; + storeState.recordPlaybackDiagnosticEvent({ + kind: "stream.exhausted", + message: "Streaming playback reached end-of-stream while playing", + meta: { + streamTimeSec: Number(snapshot.timeSec.toFixed(3)), + requestedPlaybackSec: Number(playbackClockRef.current.toFixed(3)), + }, + }); + } + storeState.setPlaybackStatus("paused"); + } else if (!snapshot.exhausted) { + exhaustedEventLoggedRef.current = false; + } + + const timeMs = playbackClockRef.current * 1000; + if (Math.abs(timeMs - playback.timeMs) > 0.5) { + storeState.setPlaybackTime(timeMs); + } + }); return ( - - {otherEntities.map((entity) => ( - - ))} + + + {entities.map((entity) => ( + + ))} + + {firstPersonShape && ( + + + + )} + + ); +} + +/** Max distance at which nameplates are visible. */ +const NAMEPLATE_FADE_DISTANCE = 150; + +/** Height above the entity origin to place the nameplate (above the player's head). */ +const NAMEPLATE_HEIGHT = 2.8; + +/** + * Floating nameplate above a player model showing the entity name and a health + * bar. Fades out with distance. + */ +function PlayerNameplate({ + entity, + timeRef, +}: { + entity: DemoEntity; + timeRef: MutableRefObject; +}) { + const { camera } = useThree(); + const groupRef = useRef(null); + const containerRef = useRef(null); + const fillRef = useRef(null); + const [isVisible, setIsVisible] = useState(true); + + const displayName = useMemo(() => { + if (entity.playerName) return entity.playerName; + if (typeof entity.id === "string") { + return entity.id.replace(/^player_/, "Player "); + } + return `Player ${entity.id}`; + }, [entity.id, entity.playerName]); + + // Check whether this entity has any health data at all. + const hasHealthData = useMemo( + () => entity.keyframes.some((kf) => kf.health != null), + [entity.keyframes], + ); + + useFrame(() => { + const group = groupRef.current; + if (!group) return; + + // Compute world-space distance to camera. + group.getWorldPosition(_tmpVec); + const distance = camera.position.distanceTo(_tmpVec); + const shouldBeVisible = distance < NAMEPLATE_FADE_DISTANCE; + + if (isVisible !== shouldBeVisible) { + setIsVisible(shouldBeVisible); + } + + if (!shouldBeVisible) return; + + // Update opacity. + if (containerRef.current) { + const opacity = Math.max( + 0, + Math.min(1, 1 - distance / NAMEPLATE_FADE_DISTANCE), + ); + containerRef.current.style.opacity = opacity.toString(); + } + + // Update health bar fill. + if (fillRef.current && hasHealthData) { + const kf = getKeyframeAtTime(entity.keyframes, timeRef.current); + const health = kf?.health ?? 1; + fillRef.current.style.width = `${Math.max(0, Math.min(100, health * 100))}%`; + fillRef.current.style.background = entity.iffColor + ? `rgb(${entity.iffColor.r}, ${entity.iffColor.g}, ${entity.iffColor.b})` + : ""; + } + }); + + return ( + + {isVisible && ( + +
+
{displayName}
+ {hasHealthData && ( +
+
+
+ )} +
+ + )} + + ); +} + +function DemoSpriteProjectile({ visual }: { visual: DemoSpriteVisual }) { + const url = textureToUrl(visual.texture); + const texture = useTexture(url, (tex) => { + const t = Array.isArray(tex) ? tex[0] : tex; + setupEffectTexture(t); + }); + const map = Array.isArray(texture) ? texture[0] : texture; + + // Convert sRGB datablock color to linear for Three.js material. + const color = useMemo( + () => + new Color().setRGB(visual.color.r, visual.color.g, visual.color.b, SRGBColorSpace), + [visual.color.r, visual.color.g, visual.color.b], + ); + + return ( + + + + ); +} + +function DemoTracerProjectile({ + entity, + visual, +}: { + entity: DemoEntity; + visual: DemoTracerVisual; +}) { + const tracerRef = useRef(null); + const tracerPosRef = useRef(null); + const crossRef = useRef(null); + const orientQuatRef = useRef(new Quaternion()); + const tracerUrls = useMemo( + () => [ + textureToUrl(visual.texture), + textureToUrl(visual.crossTexture ?? visual.texture), + ], + [visual.texture, visual.crossTexture], + ); + const textures = useTexture(tracerUrls, (loaded) => { + const list = Array.isArray(loaded) ? loaded : [loaded]; + for (const tex of list) { + setupEffectTexture(tex); + } + }); + const [tracerTexture, crossTexture] = Array.isArray(textures) + ? textures + : [textures, textures]; + + useFrame(({ camera }) => { + const tracerMesh = tracerRef.current; + const posAttr = tracerPosRef.current; + if (!tracerMesh || !posAttr) return; + + const kf = entity.keyframes[0]; + const pos = kf?.position; + const direction = entity.direction ?? kf?.velocity; + if (!pos || !direction) { + tracerMesh.visible = false; + if (crossRef.current) crossRef.current.visible = false; + return; + } + + torqueVecToThree(direction, _tracerDir); + if (_tracerDir.lengthSq() < 1e-8) { + tracerMesh.visible = false; + if (crossRef.current) crossRef.current.visible = false; + return; + } + _tracerDir.normalize(); + + tracerMesh.visible = true; + torqueVecToThree(pos, _tracerWorldPos); + _tracerDirFromCam.copy(_tracerWorldPos).sub(camera.position); + _tracerCross.crossVectors(_tracerDirFromCam, _tracerDir); + if (_tracerCross.lengthSq() < 1e-8) { + _tracerCross.crossVectors(_upY, _tracerDir); + if (_tracerCross.lengthSq() < 1e-8) { + _tracerCross.set(1, 0, 0); + } + } + _tracerCross.normalize().multiplyScalar(visual.tracerWidth); + + const halfLength = visual.tracerLength * 0.5; + _tracerStart.copy(_tracerDir).multiplyScalar(-halfLength); + _tracerEnd.copy(_tracerDir).multiplyScalar(halfLength); + + const posArray = posAttr.array as Float32Array; + posArray[0] = _tracerStart.x + _tracerCross.x; + posArray[1] = _tracerStart.y + _tracerCross.y; + posArray[2] = _tracerStart.z + _tracerCross.z; + posArray[3] = _tracerStart.x - _tracerCross.x; + posArray[4] = _tracerStart.y - _tracerCross.y; + posArray[5] = _tracerStart.z - _tracerCross.z; + posArray[6] = _tracerEnd.x - _tracerCross.x; + posArray[7] = _tracerEnd.y - _tracerCross.y; + posArray[8] = _tracerEnd.z - _tracerCross.z; + posArray[9] = _tracerEnd.x + _tracerCross.x; + posArray[10] = _tracerEnd.y + _tracerCross.y; + posArray[11] = _tracerEnd.z + _tracerCross.z; + posAttr.needsUpdate = true; + + const crossMesh = crossRef.current; + if (!crossMesh) return; + if (!visual.renderCross) { + crossMesh.visible = false; + return; + } + + _tracerDirFromCam.normalize(); + const angle = _tracerDir.dot(_tracerDirFromCam); + if (angle > -visual.crossViewAng && angle < visual.crossViewAng) { + crossMesh.visible = false; + return; + } + + crossMesh.visible = true; + setQuaternionFromDir(_tracerDir, orientQuatRef.current); + crossMesh.quaternion.copy(orientQuatRef.current); + crossMesh.scale.setScalar(visual.crossSize); + }); + + return ( + <> + + + + + + + + + {visual.renderCross ? ( + + + + + + + + + ) : null} + + ); +} + +/** + * Renders a non-camera demo entity. + * The group name must match the entity ID so the AnimationMixer can target it. + * Player entities use DemoPlayerModel for skeletal animation; others use + * DemoShapeModel. + */ +function DemoMissingShapeLabel({ entity }: { entity: DemoEntity }) { + const id = String(entity.id); + const bits: string[] = []; + bits.push(`${id} (${entity.type})`); + if (entity.className) bits.push(`class ${entity.className}`); + if (typeof entity.ghostIndex === "number") bits.push(`ghost ${entity.ghostIndex}`); + if (typeof entity.dataBlockId === "number") bits.push(`db ${entity.dataBlockId}`); + bits.push( + entity.shapeHint + ? `shapeHint ${entity.shapeHint}` + : "shapeHint ", + ); + return {bits.join(" | ")}; +} + +function DemoEntityGroup({ + entity, + timeRef, +}: { + entity: DemoEntity; + timeRef: MutableRefObject; +}) { + const debug = useDebug(); + const debugMode = debug?.debugMode ?? false; + const name = String(entity.id); + + if (entity.visual?.kind === "tracer") { + return ( + + + + + + {debugMode ? : null} + + + ); + } + + if (entity.visual?.kind === "sprite") { + return ( + + + + + + {debugMode ? : null} + + + ); + } + + if (!entity.dataBlock) { + return ( + + + + + + + {debugMode ? : null} + + + ); + } + + const fallback = ( + + + + + ); + + // Player entities use skeleton-preserving DemoPlayerModel for animation. + if (entity.type === "Player") { + return ( + + + + + + + + + + + ); + } + + return ( + + + + + + + + + {entity.weaponShape && ( + + + + + + + + )} ); } /** - * Renders a placeholder for a non-camera demo entity. - * The group name must match the entity ID so the AnimationMixer can target it. + * Renders a player model with skeleton-preserving animation. + * + * Uses SkeletonUtils.clone to deep-clone the GLTF scene with skeleton bindings + * intact, then drives a per-entity AnimationMixer to play movement animations + * (Root, Forward, Back, Side, Fall) selected from the keyframe velocity data. + * Weapon is attached to the animated Mount0 bone. */ -function DemoEntityGroup({ entity }: { entity: DemoEntity }) { - const name = String(entity.id); - const color = entityTypeColor(entity.type); +function DemoPlayerModel({ + entity, + timeRef, +}: { + entity: DemoEntity; + timeRef: MutableRefObject; +}) { + const engineStore = useEngineStoreApi(); + const gltf = useStaticShape(entity.dataBlock!); + + // Clone scene preserving skeleton bindings, create mixer, find Mount0 bone. + const { clonedScene, mixer, mount0 } = useMemo(() => { + const scene = SkeletonUtils.clone(gltf.scene) as Group; + processShapeScene(scene); + const mix = new AnimationMixer(scene); + + let m0: Object3D | null = null; + scene.traverse((n) => { + if (!m0 && n.name === "Mount0") m0 = n; + }); + + return { clonedScene: scene, mixer: mix, mount0: m0 }; + }, [gltf]); + + // Build case-insensitive clip lookup and start with Root animation. + const animActionsRef = useRef(new Map()); + const currentAnimRef = useRef({ name: "Root", timeScale: 1 }); + + useEffect(() => { + const actions = new Map(); + for (const clip of gltf.animations) { + const action = mixer.clipAction(clip); + actions.set(clip.name.toLowerCase(), action); + } + animActionsRef.current = actions; + + // Start with Root (idle) animation. + const rootAction = actions.get("root"); + if (rootAction) { + rootAction.play(); + } + currentAnimRef.current = { name: "Root", timeScale: 1 }; + + // Force initial pose evaluation. + mixer.update(0); + + return () => { + mixer.stopAllAction(); + animActionsRef.current = new Map(); + }; + }, [mixer, gltf.animations]); + + // Per-frame animation selection and mixer update. + useFrame((_, delta) => { + const playback = engineStore.getState().playback; + const isPlaying = playback.status === "playing"; + const time = timeRef.current; + + // Resolve velocity at current playback time. + const kf = getKeyframeAtTime(entity.keyframes, time); + const anim = pickMoveAnimation(kf?.velocity, kf?.rotation ?? [0, 0, 0, 1]); + + // Switch animation if the target changed. + const prev = currentAnimRef.current; + if (anim.animation !== prev.name || anim.timeScale !== prev.timeScale) { + const actions = animActionsRef.current; + const prevAction = actions.get(prev.name.toLowerCase()); + const nextAction = actions.get(anim.animation.toLowerCase()); + + if (nextAction) { + if (isPlaying && prevAction && prevAction !== nextAction) { + // Crossfade when playing. + prevAction.fadeOut(ANIM_TRANSITION_TIME); + nextAction.reset().fadeIn(ANIM_TRANSITION_TIME).play(); + } else { + // Immediate switch when paused or same clip (direction change). + if (prevAction && prevAction !== nextAction) prevAction.stop(); + nextAction.reset().play(); + } + nextAction.timeScale = anim.timeScale; + currentAnimRef.current = { + name: anim.animation, + timeScale: anim.timeScale, + }; + } + } + + // Advance or evaluate the body animation mixer. + if (isPlaying) { + mixer.update(delta * playback.rate); + } else { + mixer.update(0); + } + }); return ( - - - - - - + <> + + + + {entity.weaponShape && mount0 && ( + + + + + + )} + ); } +/** + * Imperatively attaches a weapon model to the animated Mount0 bone. + * Computes the Mountpoint inverse offset so the weapon's grip aligns with + * the player's hand. The weapon follows the animated skeleton automatically. + */ +function AnimatedWeaponMount({ + weaponShape, + mount0, +}: { + weaponShape: string; + mount0: Object3D; +}) { + const weaponGltf = useStaticShape(weaponShape); + + useEffect(() => { + const weaponClone = weaponGltf.scene.clone(true); + processShapeScene(weaponClone); + + // Compute Mountpoint inverse offset so the weapon's grip aligns to Mount0. + const mp = getPosedNodeTransform( + weaponGltf.scene, + weaponGltf.animations, + "Mountpoint", + ); + if (mp) { + const invQuat = mp.quaternion.clone().invert(); + const invPos = mp.position.clone().negate().applyQuaternion(invQuat); + weaponClone.position.copy(invPos); + weaponClone.quaternion.copy(invQuat); + } + + mount0.add(weaponClone); + + return () => { + mount0.remove(weaponClone); + }; + }, [weaponGltf, mount0]); + + return null; +} + +/** Renders a shape model for a demo entity using the existing shape pipeline. */ +function DemoShapeModel({ + shapeName, + entityId, +}: { + shapeName: string; + entityId: number | string; +}) { + const torqueObject = useMemo( + () => ({ + _class: "player", + _className: "Player", + _id: typeof entityId === "number" ? entityId : 0, + }), + [entityId], + ); + + return ( + + + + ); +} + +/** + * Renders a mounted weapon using the Torque engine's mount system. + * + * The weapon's `Mountpoint` node is aligned to the player's `Mount0` node + * (right hand). Both nodes come from the GLB skeleton in its idle ("Root" + * animation) pose. The mount transform is conjugated by ShapeRenderer's 90° Y + * rotation: T_mount = R90 * M0 * MP^(-1) * R90^(-1). + */ +function DemoWeaponModel({ + shapeName, + playerShapeName, +}: { + shapeName: string; + playerShapeName: string; +}) { + const playerGltf = useStaticShape(playerShapeName); + const weaponGltf = useStaticShape(shapeName); + + const mountTransform = useMemo(() => { + // Get Mount0 from the player's posed (Root animation) skeleton. + const m0 = getPosedNodeTransform( + playerGltf.scene, + playerGltf.animations, + "Mount0", + ); + if (!m0) return { position: undefined, quaternion: undefined }; + + // Get Mountpoint from weapon (may not be animated). + const mp = getPosedNodeTransform( + weaponGltf.scene, + weaponGltf.animations, + "Mountpoint", + ); + + // Compute T_mount = R90 * M0 * MP^(-1) * R90^(-1) + // This conjugates the GLB-space mount transform by ShapeRenderer's 90° Y + // rotation so the weapon is correctly oriented in entity space. + let combinedPos: Vector3; + let combinedQuat: Quaternion; + + if (mp) { + // MP^(-1) + const mpInvQuat = mp.quaternion.clone().invert(); + const mpInvPos = mp.position.clone().negate().applyQuaternion(mpInvQuat); + + // M0 * MP^(-1) + combinedQuat = m0.quaternion.clone().multiply(mpInvQuat); + combinedPos = mpInvPos + .clone() + .applyQuaternion(m0.quaternion) + .add(m0.position); + } else { + combinedPos = m0.position.clone(); + combinedQuat = m0.quaternion.clone(); + } + + // R90 * combined * R90^(-1) + const mountPos = combinedPos.applyQuaternion(_r90); + const mountQuat = _r90.clone().multiply(combinedQuat).multiply(_r90inv); + + return { position: mountPos, quaternion: mountQuat }; + }, [playerGltf, weaponGltf]); + + const torqueObject = useMemo( + () => ({ + _class: "weapon", + _className: "Weapon", + _id: 0, + }), + [], + ); + + return ( + + + + + + ); +} + +/** + * Extracts the eye offset from a player model's Eye bone in the idle ("Root" + * animation) pose. The Eye node is a child of "Bip01 Head" in the skeleton + * hierarchy. Its world Y in GLB Y-up space gives the height above the player's + * feet, which we use as the first-person camera offset. + */ +function PlayerEyeOffset({ + shapeName, + eyeOffsetRef, +}: { + shapeName: string; + eyeOffsetRef: MutableRefObject; +}) { + const gltf = useStaticShape(shapeName); + + useEffect(() => { + // Get Eye node position from the posed (Root animation) skeleton. + const eye = getPosedNodeTransform(gltf.scene, gltf.animations, "Eye"); + if (eye) { + // Convert from GLB space to entity space via ShapeRenderer's R90: + // R90 maps GLB (x,y,z) → entity (z, y, -x). + // This gives ~(0.169, 2.122, 0.0) — 17cm forward and 2.12m up. + eyeOffsetRef.current.set(eye.position.z, eye.position.y, -eye.position.x); + } else { + eyeOffsetRef.current.set(0, DEFAULT_EYE_HEIGHT, 0); + } + }, [gltf, eyeOffsetRef]); + + return null; +} + +/** Error boundary that renders a fallback when shape loading fails. */ +class ShapeErrorBoundary extends Component< + { children: ReactNode; fallback: ReactNode }, + { hasError: boolean } +> { + state = { hasError: false }; + + static getDerivedStateFromError() { + return { hasError: true }; + } + + componentDidCatch(error: Error, info: ErrorInfo) { + console.warn( + "[demo] Shape load failed:", + error.message, + info.componentStack, + ); + } + + render() { + if (this.state.hasError) { + return this.props.fallback; + } + return this.props.children; + } +} + function entityTypeColor(type: string): string { switch (type.toLowerCase()) { case "player": @@ -237,6 +2290,8 @@ function entityTypeColor(type: string): string { return "#ff8800"; case "projectile": return "#ff0044"; + case "deployable": + return "#ffcc00"; default: return "#8888ff"; } diff --git a/src/components/DemoProvider.tsx b/src/components/DemoProvider.tsx index 35c6d5e1..62c87c4d 100644 --- a/src/components/DemoProvider.tsx +++ b/src/components/DemoProvider.tsx @@ -1,13 +1,6 @@ -import { - createContext, - useCallback, - useContext, - useMemo, - useRef, - useState, - type ReactNode, -} from "react"; +import { useCallback, type ReactNode } from "react"; import type { DemoRecording } from "../demo/types"; +import { useEngineSelector } from "../state"; interface DemoContextValue { recording: DemoRecording | null; @@ -20,123 +13,107 @@ interface DemoContextValue { pause: () => void; seek: (time: number) => void; setSpeed: (speed: number) => void; - /** Ref used by the scene component to sync playback time back to context. */ - playbackRef: React.RefObject; -} - -export interface PlaybackState { - isPlaying: boolean; - currentTime: number; - speed: number; - /** Set by the provider when seeking; cleared by the scene component. */ - pendingSeek: number | null; - /** Set by the provider when play/pause changes; cleared by the scene. */ - pendingPlayState: boolean | null; -} - -const DemoContext = createContext(null); - -export function useDemo() { - const context = useContext(DemoContext); - if (!context) { - throw new Error("useDemo must be used within DemoProvider"); - } - return context; -} - -export function useDemoOptional() { - return useContext(DemoContext); } export function DemoProvider({ children }: { children: ReactNode }) { - const [recording, setRecording] = useState(null); - const [isPlaying, setIsPlaying] = useState(false); - const [currentTime, setCurrentTime] = useState(0); - const [speed, setSpeed] = useState(1); + return <>{children}; +} - const playbackRef = useRef({ - isPlaying: false, - currentTime: 0, - speed: 1, - pendingSeek: null, - pendingPlayState: null, - }); +export function useDemoRecording(): DemoRecording | null { + return useEngineSelector((state) => state.playback.recording); +} - const duration = recording?.duration ?? 0; +export function useDemoIsPlaying(): boolean { + return useEngineSelector((state) => state.playback.status === "playing"); +} + +export function useDemoCurrentTime(): number { + return useEngineSelector((state) => state.playback.timeMs / 1000); +} + +export function useDemoDuration(): number { + return useEngineSelector((state) => state.playback.durationMs / 1000); +} + +export function useDemoSpeed(): number { + return useEngineSelector((state) => state.playback.rate); +} + +export function useDemoActions() { + const recording = useDemoRecording(); + const setDemoRecording = useEngineSelector((state) => state.setDemoRecording); + const setPlaybackStatus = useEngineSelector( + (state) => state.setPlaybackStatus, + ); + const setPlaybackTime = useEngineSelector((state) => state.setPlaybackTime); + const setPlaybackRate = useEngineSelector((state) => state.setPlaybackRate); + + const setRecording = useCallback( + (recording: DemoRecording | null) => { + setDemoRecording(recording); + }, + [setDemoRecording], + ); const play = useCallback(() => { - setIsPlaying(true); - playbackRef.current.pendingPlayState = true; - }, []); + if ( + (recording?.isMetadataOnly || recording?.isPartial) && + !recording.streamingPlayback + ) { + return; + } + setPlaybackStatus("playing"); + }, [recording, setPlaybackStatus]); const pause = useCallback(() => { - setIsPlaying(false); - playbackRef.current.pendingPlayState = false; - }, []); + setPlaybackStatus("paused"); + }, [setPlaybackStatus]); - const seek = useCallback((time: number) => { - setCurrentTime(time); - playbackRef.current.pendingSeek = time; - }, []); - - const handleSetSpeed = useCallback((newSpeed: number) => { - setSpeed(newSpeed); - playbackRef.current.speed = newSpeed; - }, []); - - const handleSetRecording = useCallback((rec: DemoRecording | null) => { - setRecording(rec); - setIsPlaying(false); - setCurrentTime(0); - setSpeed(1); - playbackRef.current.isPlaying = false; - playbackRef.current.currentTime = 0; - playbackRef.current.speed = 1; - playbackRef.current.pendingSeek = null; - playbackRef.current.pendingPlayState = null; - }, []); - - /** - * Called by DemoPlayback on each frame to sync the current time back - * to React state (throttled by the scene component). - */ - const updateCurrentTime = useCallback((time: number) => { - setCurrentTime(time); - }, []); - - // Attach the updater to the ref so the scene component can call it - // without needing it as a dependency. - (playbackRef.current as any).updateCurrentTime = updateCurrentTime; - - const context: DemoContextValue = useMemo( - () => ({ - recording, - setRecording: handleSetRecording, - isPlaying, - currentTime, - duration, - speed, - play, - pause, - seek, - setSpeed: handleSetSpeed, - playbackRef, - }), - [ - recording, - handleSetRecording, - isPlaying, - currentTime, - duration, - speed, - play, - pause, - seek, - handleSetSpeed, - ], + const seek = useCallback( + (time: number) => { + setPlaybackTime(time * 1000); + }, + [setPlaybackTime], ); - return ( - {children} + const setSpeed = useCallback( + (speed: number) => { + setPlaybackRate(speed); + }, + [setPlaybackRate], ); + + return { + setRecording, + play, + pause, + seek, + setSpeed, + }; +} + +export function useDemo(): DemoContextValue { + const recording = useDemoRecording(); + const isPlaying = useDemoIsPlaying(); + const currentTime = useDemoCurrentTime(); + const duration = useDemoDuration(); + const speed = useDemoSpeed(); + const actions = useDemoActions(); + + return { + recording, + isPlaying, + currentTime, + duration, + speed, + setRecording: actions.setRecording, + play: actions.play, + pause: actions.pause, + seek: actions.seek, + setSpeed: actions.setSpeed, + }; +} + +export function useDemoOptional(): DemoContextValue { + return useDemo(); } diff --git a/src/components/ForceFieldBare.tsx b/src/components/ForceFieldBare.tsx index e4794059..798411ea 100644 --- a/src/components/ForceFieldBare.tsx +++ b/src/components/ForceFieldBare.tsx @@ -211,9 +211,17 @@ export const ForceFieldBare = memo(function ForceFieldBare({ [datablock, numFrames], ); - // Don't render if we have no textures + // Render fallback mesh when textures are missing instead of disappearing. if (textureUrls.length === 0) { - return null; + return ( + + + + ); } return ( diff --git a/src/components/GenericShape.tsx b/src/components/GenericShape.tsx index 8a02e6ec..edb6c15d 100644 --- a/src/components/GenericShape.tsx +++ b/src/components/GenericShape.tsx @@ -1,6 +1,7 @@ -import { memo, Suspense, useMemo } from "react"; +import { memo, Suspense, useMemo, useRef } from "react"; import { ErrorBoundary } from "react-error-boundary"; import { useGLTF, useTexture } from "@react-three/drei"; +import { useFrame } from "@react-three/fiber"; import { FALLBACK_TEXTURE_URL, textureToUrl, shapeToUrl } from "../loaders"; import { filterGeometryByVertexGroups, getHullBoneIndices } from "../meshUtils"; import { @@ -10,9 +11,10 @@ import { AdditiveBlending, Texture, BufferGeometry, + Group, } from "three"; import { setupTexture } from "../textureUtils"; -import { useDebug } from "./SettingsProvider"; +import { useDebug, useSettings } from "./SettingsProvider"; import { useShapeInfo, isOrganicShape } from "./ShapeInfoProvider"; import { FloatingLabel } from "./FloatingLabel"; import { useIflTexture } from "./useIflTexture"; @@ -28,6 +30,10 @@ interface TextureProps { backGeometry?: BufferGeometry; castShadow?: boolean; receiveShadow?: boolean; + /** DTS object visibility (0–1). Values < 1 enable alpha blending. */ + vis?: number; + /** When true, material is created transparent for vis keyframe animation. */ + animated?: boolean; } /** @@ -49,7 +55,7 @@ type MaterialResult = /** * Helper to apply volumetric fog and lighting multipliers to a material */ -function applyShapeShaderModifications( +export function applyShapeShaderModifications( mat: MeshBasicMaterial | MeshLambertMaterial, ): void { mat.onBeforeCompile = (shader) => { @@ -61,24 +67,33 @@ function applyShapeShaderModifications( }; } -function createMaterialFromFlags( +export function createMaterialFromFlags( baseMaterial: MeshStandardMaterial, texture: Texture, flagNames: Set, isOrganic: boolean, + vis: number = 1, + animated: boolean = false, ): MaterialResult { const isTranslucent = flagNames.has("Translucent"); const isAdditive = flagNames.has("Additive"); const isSelfIlluminating = flagNames.has("SelfIlluminating"); + // DTS per-object visibility: when vis < 1, the engine sets fadeSet=true which + // forces the Translucent flag and renders with GL_SRC_ALPHA/GL_ONE_MINUS_SRC_ALPHA. + // Animated vis also needs transparent materials so opacity can be updated per frame. + const isFaded = vis < 1 || animated; // SelfIlluminating materials are unlit (use MeshBasicMaterial) if (isSelfIlluminating) { + const isBlended = isAdditive || isTranslucent || isFaded; const mat = new MeshBasicMaterial({ map: texture, side: 2, // DoubleSide - transparent: isAdditive, - alphaTest: isAdditive ? 0 : 0.5, + transparent: isBlended, + depthWrite: !isBlended, + alphaTest: 0, fog: true, + ...(isFaded && { opacity: vis }), ...(isAdditive && { blending: AdditiveBlending }), }); applyShapeShaderModifications(mat); @@ -92,8 +107,11 @@ function createMaterialFromFlags( if (isOrganic || isTranslucent) { const baseProps = { map: texture, - transparent: false, - alphaTest: 0.5, + // When vis < 1, switch from alpha cutout to alpha blend (matching the engine's + // fadeSet behavior which forces GL_BLEND with no alpha test) + transparent: isFaded, + alphaTest: isFaded ? 0 : 0.5, + ...(isFaded && { opacity: vis, depthWrite: false }), reflectivity: 0, }; const backMat = new MeshLambertMaterial({ @@ -119,6 +137,11 @@ function createMaterialFromFlags( map: texture, side: 2, // DoubleSide reflectivity: 0, + ...(isFaded && { + transparent: true, + opacity: vis, + depthWrite: false, + }), }); applyShapeShaderModifications(mat); return mat; @@ -143,6 +166,8 @@ const IflTexture = memo(function IflTexture({ backGeometry, castShadow = false, receiveShadow = false, + vis = 1, + animated = false, }: TextureProps) { const resourcePath = material.userData.resource_path; const flagNames = new Set(material.userData.flag_names ?? []); @@ -152,8 +177,16 @@ const IflTexture = memo(function IflTexture({ const isOrganic = shapeName && isOrganicShape(shapeName); const customMaterial = useMemo( - () => createMaterialFromFlags(material, texture, flagNames, isOrganic), - [material, texture, flagNames, isOrganic], + () => + createMaterialFromFlags( + material, + texture, + flagNames, + isOrganic, + vis, + animated, + ), + [material, texture, flagNames, isOrganic, vis, animated], ); // Two-pass rendering for organic/translucent materials @@ -197,6 +230,8 @@ const StaticTexture = memo(function StaticTexture({ backGeometry, castShadow = false, receiveShadow = false, + vis = 1, + animated = false, }: TextureProps) { const resourcePath = material.userData.resource_path; const flagNames = new Set(material.userData.flag_names ?? []); @@ -223,8 +258,16 @@ const StaticTexture = memo(function StaticTexture({ }); const customMaterial = useMemo( - () => createMaterialFromFlags(material, texture, flagNames, isOrganic), - [material, texture, flagNames, isOrganic], + () => + createMaterialFromFlags( + material, + texture, + flagNames, + isOrganic, + vis, + animated, + ), + [material, texture, flagNames, isOrganic, vis, animated], ); // Two-pass rendering for organic/translucent materials @@ -268,6 +311,8 @@ export const ShapeTexture = memo(function ShapeTexture({ backGeometry, castShadow = false, receiveShadow = false, + vis = 1, + animated = false, }: TextureProps) { const flagNames = new Set(material.userData.flag_names ?? []); const isIflMaterial = flagNames.has("IflMaterial"); @@ -283,6 +328,8 @@ export const ShapeTexture = memo(function ShapeTexture({ backGeometry={backGeometry} castShadow={castShadow} receiveShadow={receiveShadow} + vis={vis} + animated={animated} /> ); } else if (material.name) { @@ -294,6 +341,8 @@ export const ShapeTexture = memo(function ShapeTexture({ backGeometry={backGeometry} castShadow={castShadow} receiveShadow={receiveShadow} + vis={vis} + animated={animated} /> ); } else { @@ -328,6 +377,22 @@ export function DebugPlaceholder({ return debugMode ? : null; } +/** Shapes that don't have a .glb conversion and are rendered with built-in + * Three.js geometry instead. These are editor-only markers in Tribes 2. */ +const HARDCODED_SHAPES = new Set(["octahedron.dts"]); + +function HardcodedShape({ label }: { label?: string }) { + const { debugMode } = useDebug(); + if (!debugMode) return null; + return ( + + + + {label ? {label} : null} + + ); +} + /** * Wrapper component that handles the common ErrorBoundary + Suspense + ShapeModel * pattern used across shape-rendering components. @@ -347,6 +412,10 @@ export function ShapeRenderer({ ); } + if (HARDCODED_SHAPES.has(shapeName.toLowerCase())) { + return ; + } + return ( 1 && + (userData.vis_duration ?? 0) > 0 + ); +} + +/** + * Wraps child meshes and animates their material opacity using DTS vis keyframes. + * Used for auto-playing "Ambient" sequences (glow pulses, light effects). + */ +function AnimatedVisGroup({ + keyframes, + duration, + cyclic, + children, +}: { + keyframes: number[]; + duration: number; + cyclic: boolean; + children: React.ReactNode; +}) { + const groupRef = useRef(null); + const { animationEnabled } = useSettings(); + + useFrame(() => { + const group = groupRef.current; + if (!group) return; + + if (!animationEnabled) { + group.traverse((child) => { + if ((child as any).isMesh) { + const mat = (child as any).material; + if (mat && !Array.isArray(mat)) { + mat.opacity = keyframes[0]; + } + } + }); + return; + } + + const elapsed = performance.now() / 1000; + const t = cyclic + ? (elapsed % duration) / duration + : Math.min(elapsed / duration, 1); + + const n = keyframes.length; + const pos = t * n; + const lo = Math.floor(pos) % n; + const hi = (lo + 1) % n; + const frac = pos - Math.floor(pos); + const vis = keyframes[lo] + (keyframes[hi] - keyframes[lo]) * frac; + + group.traverse((child) => { + if ((child as any).isMesh) { + const mat = (child as any).material; + if (mat && !Array.isArray(mat)) { + mat.opacity = vis; + } + } + }); + }); + + return {children}; +} + export const ShapeModel = memo(function ShapeModel() { const { object, shapeName, isOrganic } = useShapeInfo(); const { debugMode } = useDebug(); @@ -384,7 +523,12 @@ export const ShapeModel = memo(function ShapeModel() { ([name, node]: [string, any]) => node.material && node.material.name !== "Unassigned" && - !node.name.match(/^Hulk/i), + !node.name.match(/^Hulk/i) && + // DTS per-object visibility: skip invisible objects (engine threshold + // is 0.01) unless they have an Ambient vis animation that will bring + // them to life (e.g. glow effects that pulse from 0 to 1). + ((node.userData?.vis ?? 1) > 0.01 || + hasAmbientVisAnimation(node.userData)), ) .map(([name, node]: [string, any]) => { let geometry = filterGeometryByVertexGroups( @@ -459,7 +603,15 @@ export const ShapeModel = memo(function ShapeModel() { } } - return { node, geometry, backGeometry }; + const vis: number = node.userData?.vis ?? 1; + const visAnim = hasAmbientVisAnimation(node.userData) + ? { + keyframes: node.userData.vis_keyframes as number[], + duration: node.userData.vis_duration as number, + cyclic: !!node.userData.vis_cyclic, + } + : undefined; + return { node, geometry, backGeometry, vis, visAnim }; }); }, [nodes, hullBoneIndices, isOrganic]); @@ -469,41 +621,61 @@ export const ShapeModel = memo(function ShapeModel() { return ( - {processedNodes.map(({ node, geometry, backGeometry }) => ( - - - - } - > - {node.material ? ( - Array.isArray(node.material) ? ( - node.material.map((mat, index) => ( - - )) - ) : ( + {processedNodes.map(({ node, geometry, backGeometry, vis, visAnim }) => { + const animated = !!visAnim; + const fallback = ( + + + + ); + const textures = node.material ? ( + Array.isArray(node.material) ? ( + node.material.map((mat, index) => ( - ) - ) : null} - - ))} + )) + ) : ( + + ) + ) : null; + + if (visAnim) { + return ( + + {textures} + + ); + } + + return ( + + {textures} + + ); + })} {debugMode ? ( {object._id}: {shapeName} diff --git a/src/components/InspectorControls.tsx b/src/components/InspectorControls.tsx index dc68b277..c6ea6e49 100644 --- a/src/components/InspectorControls.tsx +++ b/src/components/InspectorControls.tsx @@ -9,6 +9,7 @@ import { RefObject, useEffect, useState, useRef } from "react"; import { Camera } from "three"; import { CopyCoordinatesButton } from "./CopyCoordinatesButton"; import { LoadDemoButton } from "./LoadDemoButton"; +import { useDemoRecording } from "./DemoProvider"; import { FiInfo, FiSettings } from "react-icons/fi"; export function InspectorControls({ @@ -45,6 +46,8 @@ export function InspectorControls({ const { speedMultiplier, setSpeedMultiplier, touchMode, setTouchMode } = useControls(); const { debugMode, setDebugMode } = useDebug(); + const demoRecording = useDemoRecording(); + const isDemoLoaded = demoRecording != null; const [settingsOpen, setSettingsOpen] = useState(false); const dropdownRef = useRef(null); const buttonRef = useRef(null); @@ -84,6 +87,7 @@ export function InspectorControls({ value={missionName} missionType={missionType} onChange={onChangeMission} + disabled={isDemoLoaded} />