mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-15 18:31:01 +00:00
521 lines
No EOL
140 KiB
JavaScript
521 lines
No EOL
140 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65883,e=>{e.v({ButtonGroup:"InspectorControls-module__gNRB6W__ButtonGroup",ButtonHint:"InspectorControls-module__gNRB6W__ButtonHint",ButtonLabel:"InspectorControls-module__gNRB6W__ButtonLabel",CheckboxField:"InspectorControls-module__gNRB6W__CheckboxField",Control:"InspectorControls-module__gNRB6W__Control",Description:"InspectorControls-module__gNRB6W__Description",Dropdown:"InspectorControls-module__gNRB6W__Dropdown",Field:"InspectorControls-module__gNRB6W__Field",ForceRenderButton:"InspectorControls-module__gNRB6W__ForceRenderButton",Group:"InspectorControls-module__gNRB6W__Group",IconButton:"InspectorControls-module__gNRB6W__IconButton",InspectorControls:"InspectorControls-module__gNRB6W__InspectorControls",Label:"InspectorControls-module__gNRB6W__Label",LabelledButton:"InspectorControls-module__gNRB6W__LabelledButton",MapInfoButton:"InspectorControls-module__gNRB6W__MapInfoButton InspectorControls-module__gNRB6W__IconButton InspectorControls-module__gNRB6W__LabelledButton",Toggle:"InspectorControls-module__gNRB6W__Toggle InspectorControls-module__gNRB6W__IconButton",Tools:"InspectorControls-module__gNRB6W__Tools"})},36679,e=>{e.v({ButtonLabel:"CopyCoordinatesButton-module__BxovtG__ButtonLabel "+e.i(65883).ButtonLabel,ClipboardCheck:"CopyCoordinatesButton-module__BxovtG__ClipboardCheck",MapPin:"CopyCoordinatesButton-module__BxovtG__MapPin",Root:"CopyCoordinatesButton-module__BxovtG__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,showClipboardCheck:"CopyCoordinatesButton-module__BxovtG__showClipboardCheck"})},28903,e=>{e.v({ButtonHint:"LoadDemoButton-module__kGZaoW__ButtonHint "+e.i(65883).ButtonHint,ButtonLabel:"LoadDemoButton-module__kGZaoW__ButtonLabel "+e.i(65883).ButtonLabel,Root:"LoadDemoButton-module__kGZaoW__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton})},9607,e=>{e.v({ButtonHint:"JoinServerButton-module__DIR70a__ButtonHint "+e.i(65883).ButtonHint,PingLabel:"JoinServerButton-module__DIR70a__PingLabel "+e.i(65883).ButtonLabel,Pulsing:"JoinServerButton-module__DIR70a__Pulsing",Root:"JoinServerButton-module__DIR70a__Root "+e.i(65883).IconButton+" "+e.i(65883).LabelledButton,TextLabel:"JoinServerButton-module__DIR70a__TextLabel "+e.i(65883).ButtonLabel,blink:"JoinServerButton-module__DIR70a__blink"})},81323,e=>{e.v({AccordionGroup:"Accordion-module__rN-DYq__AccordionGroup",Body:"Accordion-module__rN-DYq__Body",Content:"Accordion-module__rN-DYq__Content",Trigger:"Accordion-module__rN-DYq__Trigger",TriggerIcon:"Accordion-module__rN-DYq__TriggerIcon",slideDown:"Accordion-module__rN-DYq__slideDown",slideUp:"Accordion-module__rN-DYq__slideUp"})},16964,e=>{e.v({ActionButton:"StreamingMissionInfo-module__hEaQnW__ActionButton "+e.i(65883).IconButton,Attribution:"StreamingMissionInfo-module__hEaQnW__Attribution",EjectIcon:"StreamingMissionInfo-module__hEaQnW__EjectIcon",Error:"StreamingMissionInfo-module__hEaQnW__Error",Header:"StreamingMissionInfo-module__hEaQnW__Header",Metadata:"StreamingMissionInfo-module__hEaQnW__Metadata",MissionInfo:"StreamingMissionInfo-module__hEaQnW__MissionInfo",MissionName:"StreamingMissionInfo-module__hEaQnW__MissionName "+e.i(97442).SelectedName,MissionType:"StreamingMissionInfo-module__hEaQnW__MissionType "+e.i(97442).ItemType,MissionTypeDisplayName:"StreamingMissionInfo-module__hEaQnW__MissionTypeDisplayName",PlayerName:"StreamingMissionInfo-module__hEaQnW__PlayerName",RecordingDate:"StreamingMissionInfo-module__hEaQnW__RecordingDate",ServerInfo:"StreamingMissionInfo-module__hEaQnW__ServerInfo",ServerName:"StreamingMissionInfo-module__hEaQnW__ServerName"})},29418,e=>{e.v({Bottom:"PlayerNameplate-module__zYDm0a__Bottom PlayerNameplate-module__zYDm0a__Root",HealthBar:"PlayerNameplate-module__zYDm0a__HealthBar",HealthFill:"PlayerNameplate-module__zYDm0a__HealthFill",IffArrow:"PlayerNameplate-module__zYDm0a__IffArrow",Name:"PlayerNameplate-module__zYDm0a__Name",Root:"PlayerNameplate-module__zYDm0a__Root",Top:"PlayerNameplate-module__zYDm0a__Top PlayerNameplate-module__zYDm0a__Root"})},78779,e=>{e.v({Distance:"FlagMarker-module__INpLba__Distance",Icon:"FlagMarker-module__INpLba__Icon",Root:"FlagMarker-module__INpLba__Root"})},89271,e=>{e.v({LoadingIndicator:"LoadingIndicator-module__F20Nda__LoadingIndicator",Progress:"LoadingIndicator-module__F20Nda__Progress",ProgressBar:"LoadingIndicator-module__F20Nda__ProgressBar",ProgressText:"LoadingIndicator-module__F20Nda__ProgressText",Spinner:"LoadingIndicator-module__F20Nda__Spinner",loadingComplete:"LoadingIndicator-module__F20Nda__loadingComplete",spin:"LoadingIndicator-module__F20Nda__spin"})},82156,e=>{e.v({Backdrop:"MapInspector-module__nU0WNq__Backdrop",CancelButton:"MapInspector-module__nU0WNq__CancelButton",Content:"MapInspector-module__nU0WNq__Content",Frame:"MapInspector-module__nU0WNq__Frame",PlayerBar:"MapInspector-module__nU0WNq__PlayerBar",Sidebar:"MapInspector-module__nU0WNq__Sidebar",ThreeView:"MapInspector-module__nU0WNq__ThreeView",ToggleSidebarButton:"MapInspector-module__nU0WNq__ToggleSidebarButton",Toolbar:"MapInspector-module__nU0WNq__Toolbar",layout:"MapInspector-module__nU0WNq__layout"})},31713,e=>{"use strict";var t,r=e.i(43476),n=e.i(932),a=e.i(71645),o=e.i(17751),i=e.i(12598),l=e.i(38847);let s=(0,a.createContext)({live:!1});function c(e){let t,o,i=(0,n.c)(5),{children:c}=e,[d]=(0,l.useQueryState)("features",l.parseAsString);i[0]!==d?(t=()=>({live:new Set((d??"").split(",").map(u).filter(Boolean)).has("live")}),i[0]=d,i[1]=t):t=i[1];let[m]=(0,a.useState)(t);return i[2]!==c||i[3]!==m?(o=(0,r.jsx)(s.Provider,{value:m,children:c}),i[2]=c,i[3]=m,i[4]=o):o=i[4],o}function u(e){return e.trim().toLowerCase()}var d=e.i(40141);function m(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 21L11.2381 12.2698L15 6L23 21H16ZM8 10L14 21H2L8 10ZM5.5 8C4.11929 8 3 6.88071 3 5.5C3 4.11929 4.11929 3 5.5 3C6.88071 3 8 4.11929 8 5.5C8 6.88071 6.88071 8 5.5 8Z"},child:[]}]})(e)}function f(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0c-41.8 0-77.4 26.7-90.5 64L64 64C28.7 64 0 92.7 0 128L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64l-37.5 0C269.4 26.7 233.8 0 192 0zm0 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM305 273L177 401c-9.4 9.4-24.6 9.4-33.9 0L79 337c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L271 239c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"},child:[]}]})(e)}function h(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"},child:[]}]})(e)}function p(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8V2h6"},child:[]},{tag:"path",attr:{d:"m2 2 10 10"},child:[]},{tag:"path",attr:{d:"M12 2A10 10 0 1 1 2 12"},child:[]}]})(e)}function g(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},child:[]},{tag:"path",attr:{d:"M12 11h4"},child:[]},{tag:"path",attr:{d:"M12 16h4"},child:[]},{tag:"path",attr:{d:"M8 11h.01"},child:[]},{tag:"path",attr:{d:"M8 16h.01"},child:[]}]})(e)}function v(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m16 15-3-3 3-3"},child:[]}]})(e)}function x(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M9 3v18"},child:[]},{tag:"path",attr:{d:"m14 9 3 3-3 3"},child:[]}]})(e)}function y(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m9 16 3-3 3 3"},child:[]}]})(e)}function b(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"3",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 9h18"},child:[]},{tag:"path",attr:{d:"m15 14-3 3-3-3"},child:[]}]})(e)}var _=e.i(79123),S=e.i(11152),w=e.i(36679);function C(e){let t,o,i,l,s,c=(0,n.c)(12),{cameraRef:u,missionName:d,missionType:m,disabled:h}=e,{fogEnabled:p}=(0,_.useSettings)(),[g,v]=(0,a.useState)(!1),x=(0,a.useRef)(null);c[0]!==u||c[1]!==p||c[2]!==d||c[3]!==m?(t=async()=>{clearTimeout(x.current);let e=u.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,a=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${a}`}(e),r=new URLSearchParams;r.set("mission",`${d}~${m}`),r.set("fog",p.toString());let n=`${window.location.pathname}?${r}${t}`,a=`${window.location.origin}${n}`;window.history.replaceState(null,"",n);try{await navigator.clipboard.writeText(a),v(!0),x.current=setTimeout(()=>{v(!1)},1100)}catch(e){console.error(e)}},c[0]=u,c[1]=p,c[2]=d,c[3]=m,c[4]=t):t=c[4];let y=t,b=g?"true":"false";return c[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(S.FaMapPin,{className:w.default.MapPin}),i=(0,r.jsx)(f,{className:w.default.ClipboardCheck}),l=(0,r.jsx)("span",{className:w.default.ButtonLabel,children:" Link to coordinates"}),c[5]=o,c[6]=i,c[7]=l):(o=c[5],i=c[6],l=c[7]),c[8]!==h||c[9]!==y||c[10]!==b?(s=(0,r.jsxs)("button",{type:"button",className:w.default.Root,"aria-label":"Link to coordinates",title:"Copy the current coordinates to URL",onClick:y,disabled:h,"data-copied":b,id:"copyCoordinatesButton",children:[o,i,l]}),c[8]=h,c[9]=y,c[10]=b,c[11]=s):s=c[11],s}function j(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 0 0-2-2zm0 14H3V5h18v12zm-5-6-7 4V7z"},child:[]}]})(e)}var M=e.i(25645),k=e.i(98755),T=e.i(32865),N=e.i(28903);let R=(0,M.createLogger)("LoadDemoButton");function D({isActive:t=!1,choosingMap:n=!1,onCancelChoosingMap:o}){let i=(0,T.useRecording)(),l=i?.source==="demo",{setRecording:s}=(0,T.usePlaybackActions)(),c=(0,a.useRef)(null),u=(0,a.useRef)(0),d=(0,a.useCallback)(()=>{if(n&&l)return void o?.();if(l){u.current+=1,s(null);return}c.current?.click()},[l,n,o,s]),m=(0,a.useCallback)(async t=>{let r=t.target.files?.[0];if(r){t.target.value="";try{let t=await r.arrayBuffer(),n=u.current+1;u.current=n;let{createDemoStreamingRecording:a}=await e.A(60946),o=await a(t);if(u.current!==n)return;let i=k.liveConnectionStore.getState();i.disconnectServer(),i.disconnectRelay(),s(o)}catch(e){R.error("Failed to load demo: %o",e)}}},[s]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:c,type:"file",accept:".rec",style:{display:"none"},onChange:m}),(0,r.jsxs)("button",{type:"button",className:N.default.Root,"aria-label":l?"Unload demo":"Load demo (.rec)",title:l?"Unload demo":"Load demo (.rec)",onClick:d,"data-active":t,children:[(0,r.jsx)(j,{className:N.default.DemoIcon}),(0,r.jsx)("span",{className:N.default.ButtonLabel,children:"Demo"}),(0,r.jsx)("span",{className:N.default.ButtonHint,children:n&&l?"Return to demo":l?"Click to unload":"Load a .rec file"})]})]})}function L(e){return(0,d.GenIcon)({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z"},child:[]}]})(e)}var F=e.i(9607);function I(e){let t,a,o,i,l,s,c=(0,n.c)(20),{isActive:u,onOpenServerBrowser:d}=e,m=(0,k.useLiveSelector)(P),f=(0,k.useLiveSelector)(k.selectPing),h=(0,k.useLiveSelector)(B),p=(0,k.useLiveSelector)(E),g="connected"===m,v="connecting"===m||"challenging"===m||"authenticating"===m,x=g?"Connected – click to disconnect":"Join server",y=g?"Connected – click to disconnect":"Join server";c[0]!==p||c[1]!==h||c[2]!==g||c[3]!==d?(t=()=>{g?(h(),p()):d()},c[0]=p,c[1]=h,c[2]=g,c[3]=d,c[4]=t):t=c[4];let b=`${F.default.LiveIcon} ${g?F.default.Pulsing:""}`;if(c[5]!==b?(a=(0,r.jsx)(L,{className:b}),c[5]=b,c[6]=a):a=c[6],c[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)("span",{className:F.default.TextLabel,children:"Live"}),c[7]=o):o=c[7],c[8]!==v||c[9]!==f)i=v?"Connecting…":null!=f?`${f.toLocaleString()} ms`:"Join a game",c[8]=v,c[9]=f,c[10]=i;else i=c[10];return c[11]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,(0,r.jsx)("span",{className:F.default.ButtonHint,children:i})]}),c[11]=i,c[12]=l):l=c[12],c[13]!==u||c[14]!==x||c[15]!==y||c[16]!==t||c[17]!==a||c[18]!==l?(s=(0,r.jsxs)("button",{type:"button",className:F.default.Root,"aria-label":x,title:y,onClick:t,"data-active":u,children:[a,l]}),c[13]=u,c[14]=x,c[15]=y,c[16]=t,c[17]=a,c[18]=l,c[19]=s):s=c[19],s}function E(e){return e.disconnectRelay}function B(e){return e.disconnectServer}function P(e){return e.gameStatus}function A(e,t=[]){let n=[],o=()=>{let t=n.map(e=>a.createContext(e));return function(r){let n=r?.[e]||t;return a.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return o.scopeName=e,[function(t,o){let i=a.createContext(o),l=n.length;n=[...n,o];let s=t=>{let{scope:n,children:o,...s}=t,c=n?.[e]?.[l]||i,u=a.useMemo(()=>s,Object.values(s));return(0,r.jsx)(c.Provider,{value:u,children:o})};return s.displayName=t+"Provider",[s,function(r,n){let s=n?.[e]?.[l]||i,c=a.useContext(s);if(c)return c;if(void 0!==o)return o;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(o,...t)]}function z(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function U(...e){return t=>{let r=!1,n=e.map(e=>{let n=z(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():z(e[t],null)}}}}function G(...e){return a.useCallback(U(...e),e)}function W(e){var t;let n,o=(t=e,(n=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(a.isValidElement(r)){var o;let e,i,l=(o=r,(i=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(i=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?U(t,l):l),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null})).displayName=`${t}.SlotClone`,n),i=a.forwardRef((e,t)=>{let{children:n,...i}=e,l=a.Children.toArray(n),s=l.find(O);if(s){let e=s.props.children,n=l.map(t=>t!==s?t:a.Children.count(e)>1?a.Children.only(null):a.isValidElement(e)?e.props.children:null);return(0,r.jsx)(o,{...i,ref:t,children:a.isValidElement(e)?a.cloneElement(e,void 0,n):null})}return(0,r.jsx)(o,{...i,ref:t,children:n})});return i.displayName=`${e}.Slot`,i}var H=Symbol("radix.slottable");function O(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===H}var V=new WeakMap;function q(e,t){var r,n;let a,o,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let l=(r=e,n=t,a=r.length,(i=(o=$(n))>=0?o:a+o)<0||i>=a?-1:i);return -1===l?void 0:e[l]}function $(e){return e!=e||0===e?0:Math.trunc(e)}function K(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],V.set(this,!0)}set(e,t){return V.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),o=this.#e.length,i=$(e),l=i>=0?i:o+i,s=l<0||l>=o?-1:l;if(s===this.size||a&&s===this.size-1||-1===s)return this.set(t,r),this;let c=this.size+ +!a;i<0&&l++;let u=[...this.#e],d=!1;for(let e=l;e<c;e++)if(l===e){let o=u[e];u[e]===t&&(o=u[e+1]),a&&this.delete(t),n=this.get(o),this.set(t,r)}else{d||u[e-1]!==t||(d=!0);let r=u[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=q(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=q(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return q(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}}),"u">typeof window&&window.document&&window.document.createElement;var Q=globalThis?.document?a.useLayoutEffect:()=>{};a[" useEffectEvent ".trim().toString()],a[" useInsertionEffect ".trim().toString()];var Y=a[" useInsertionEffect ".trim().toString()]||Q;function X({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[o,i,l]=function({defaultProp:e,onChange:t}){let[r,n]=a.useState(e),o=a.useRef(r),i=a.useRef(t);return Y(()=>{i.current=t},[t]),a.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}({defaultProp:t,onChange:r}),s=void 0!==e,c=s?e:o;{let t=a.useRef(void 0!==e);a.useEffect(()=>{let e=t.current;if(e!==s){let t=s?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=s},[s,n])}return[c,a.useCallback(t=>{if(s){let r="function"==typeof t?t(e):t;r!==e&&l.current?.(r)}else i(t)},[s,e,i,l])]}Symbol("RADIX:SYNC_STATE"),e.i(74080);var Z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=W(`Primitive.${t}`),o=a.forwardRef((e,a)=>{let{asChild:o,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(o?n:t,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),J=e=>{var t;let r,n,{present:o,children:i}=e,l=function(e){var t,r;let[n,o]=a.useState(),i=a.useRef(null),l=a.useRef(e),s=a.useRef("none"),[c,u]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},a.useReducer((e,t)=>r[e][t]??e,t));return a.useEffect(()=>{let e=ee(i.current);s.current="mounted"===c?e:"none"},[c]),Q(()=>{let t=i.current,r=l.current;if(r!==e){let n=s.current,a=ee(t);e?u("MOUNT"):"none"===a||t?.display==="none"?u("UNMOUNT"):r&&n!==a?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),Q(()=>{if(n){let e,t=n.ownerDocument.defaultView??window,r=r=>{let a=ee(i.current).includes(CSS.escape(r.animationName));if(r.target===n&&a&&(u("ANIMATION_END"),!l.current)){let r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)})}},a=e=>{e.target===n&&(s.current=ee(i.current))};return n.addEventListener("animationstart",a),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",a),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{i.current=e?getComputedStyle(e):null,o(e)},[])}}(o),s="function"==typeof i?i({present:l.isPresent}):a.Children.only(i),c=G(l.ref,(t=s,(n=(r=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in r&&r.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof i||l.isPresent?a.cloneElement(s,{ref:c}):null};function ee(e){return e?.animationName||"none"}J.displayName="Presence";var et=a[" useId ".trim().toString()]||(()=>void 0),er=0;function en(e){let[t,r]=a.useState(et());return Q(()=>{e||r(e=>e??String(er++))},[e]),e||(t?`radix-${t}`:"")}var ea="Collapsible",[eo,ei]=A(ea),[el,es]=eo(ea),ec=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:o,defaultOpen:i,disabled:l,onOpenChange:s,...c}=e,[u,d]=X({prop:o,defaultProp:i??!1,onChange:s,caller:ea});return(0,r.jsx)(el,{scope:n,disabled:l,contentId:en(),open:u,onOpenToggle:a.useCallback(()=>d(e=>!e),[d]),children:(0,r.jsx)(Z.div,{"data-state":ep(u),"data-disabled":l?"":void 0,...c,ref:t})})});ec.displayName=ea;var eu="CollapsibleTrigger",ed=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,...a}=e,o=es(eu,n);return(0,r.jsx)(Z.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ep(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...a,ref:t,onClick:K(e.onClick,o.onOpenToggle)})});ed.displayName=eu;var em="CollapsibleContent",ef=a.forwardRef((e,t)=>{let{forceMount:n,...a}=e,o=es(em,e.__scopeCollapsible);return(0,r.jsx)(J,{present:n||o.open,children:({present:e})=>(0,r.jsx)(eh,{...a,ref:t,present:e})})});ef.displayName=em;var eh=a.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:o,children:i,...l}=e,s=es(em,n),[c,u]=a.useState(o),d=a.useRef(null),m=G(t,d),f=a.useRef(0),h=f.current,p=a.useRef(0),g=p.current,v=s.open||c,x=a.useRef(v),y=a.useRef(void 0);return a.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),Q(()=>{let e=d.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();f.current=t.height,p.current=t.width,x.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),u(o)}},[s.open,o]),(0,r.jsx)(Z.div,{"data-state":ep(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...l,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&i})});function ep(e){return e?"open":"closed"}var eg=a.createContext(void 0),ev="Accordion",ex=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ey,eb,e_]=function(e){let t=e+"CollectionProvider",[n,o]=A(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,o=a.default.useRef(null),l=a.default.useRef(new Map).current;return(0,r.jsx)(i,{scope:t,itemMap:l,collectionRef:o,children:n})};s.displayName=t;let c=e+"CollectionSlot",u=W(c),d=a.default.forwardRef((e,t)=>{let{scope:n,children:a}=e,o=G(t,l(c,n).collectionRef);return(0,r.jsx)(u,{ref:o,children:a})});d.displayName=c;let m=e+"CollectionItemSlot",f="data-radix-collection-item",h=W(m),p=a.default.forwardRef((e,t)=>{let{scope:n,children:o,...i}=e,s=a.default.useRef(null),c=G(t,s),u=l(m,n);return a.default.useEffect(()=>(u.itemMap.set(s,{ref:s,...i}),()=>void u.itemMap.delete(s))),(0,r.jsx)(h,{...{[f]:""},ref:c,children:o})});return p.displayName=m,[{Provider:s,Slot:d,ItemSlot:p},function(t){let r=l(e+"CollectionConsumer",t);return a.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},o]}(ev),[eS,ew]=A(ev,[e_,ei]),eC=ei(),ej=a.default.forwardRef((e,t)=>{let{type:n,...a}=e;return(0,r.jsx)(ey.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?(0,r.jsx)(eD,{...a,ref:t}):(0,r.jsx)(eR,{...a,ref:t})})});ej.displayName=ev;var[eM,ek]=eS(ev),[eT,eN]=eS(ev,{collapsible:!1}),eR=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},collapsible:l=!1,...s}=e,[c,u]=X({prop:n,defaultProp:o??"",onChange:i,caller:ev});return(0,r.jsx)(eM,{scope:e.__scopeAccordion,value:a.default.useMemo(()=>c?[c]:[],[c]),onItemOpen:u,onItemClose:a.default.useCallback(()=>l&&u(""),[l,u]),children:(0,r.jsx)(eT,{scope:e.__scopeAccordion,collapsible:l,children:(0,r.jsx)(eI,{...s,ref:t})})})}),eD=a.default.forwardRef((e,t)=>{let{value:n,defaultValue:o,onValueChange:i=()=>{},...l}=e,[s,c]=X({prop:n,defaultProp:o??[],onChange:i,caller:ev}),u=a.default.useCallback(e=>c((t=[])=>[...t,e]),[c]),d=a.default.useCallback(e=>c((t=[])=>t.filter(t=>t!==e)),[c]);return(0,r.jsx)(eM,{scope:e.__scopeAccordion,value:s,onItemOpen:u,onItemClose:d,children:(0,r.jsx)(eT,{scope:e.__scopeAccordion,collapsible:!0,children:(0,r.jsx)(eI,{...l,ref:t})})})}),[eL,eF]=eS(ev),eI=a.default.forwardRef((e,t)=>{let n,{__scopeAccordion:o,disabled:i,dir:l,orientation:s="vertical",...c}=e,u=G(a.default.useRef(null),t),d=eb(o),m="ltr"===(n=a.useContext(eg),l||n||"ltr"),f=K(e.onKeyDown,e=>{if(!ex.includes(e.key))return;let t=e.target,r=d().filter(e=>!e.ref.current?.disabled),n=r.findIndex(e=>e.ref.current===t),a=r.length;if(-1===n)return;e.preventDefault();let o=n,i=a-1,l=()=>{(o=n+1)>i&&(o=0)},c=()=>{(o=n-1)<0&&(o=i)};switch(e.key){case"Home":o=0;break;case"End":o=i;break;case"ArrowRight":"horizontal"===s&&(m?l():c());break;case"ArrowDown":"vertical"===s&&l();break;case"ArrowLeft":"horizontal"===s&&(m?c():l());break;case"ArrowUp":"vertical"===s&&c()}let u=o%a;r[u].ref.current?.focus()});return(0,r.jsx)(eL,{scope:o,disabled:i,direction:l,orientation:s,children:(0,r.jsx)(ey.Slot,{scope:o,children:(0,r.jsx)(Z.div,{...c,"data-orientation":s,ref:u,onKeyDown:i?void 0:f})})})}),eE="AccordionItem",[eB,eP]=eS(eE),eA=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,value:a,...o}=e,i=eF(eE,n),l=ek(eE,n),s=eC(n),c=en(),u=a&&l.value.includes(a)||!1,d=i.disabled||e.disabled;return(0,r.jsx)(eB,{scope:n,open:u,disabled:d,triggerId:c,children:(0,r.jsx)(ec,{"data-orientation":i.orientation,"data-state":eO(u),...s,...o,ref:t,disabled:d,open:u,onOpenChange:e=>{e?l.onItemOpen(a):l.onItemClose(a)}})})});eA.displayName=eE;var ez="AccordionHeader";a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(ez,n);return(0,r.jsx)(Z.h3,{"data-orientation":o.orientation,"data-state":eO(i.open),"data-disabled":i.disabled?"":void 0,...a,ref:t})}).displayName=ez;var eU="AccordionTrigger",eG=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(eU,n),l=eN(eU,n),s=eC(n);return(0,r.jsx)(ey.ItemSlot,{scope:n,children:(0,r.jsx)(ed,{"aria-disabled":i.open&&!l.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...s,...a,ref:t})})});eG.displayName=eU;var eW="AccordionContent",eH=a.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...a}=e,o=eF(ev,n),i=eP(eW,n),l=eC(n);return(0,r.jsx)(ef,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...l,...a,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function eO(e){return e?"open":"closed"}function eV(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"m190.06 414 163.12-139.78a24 24 0 0 0 0-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z"},child:[]}]})(e)}eH.displayName=eW;var eq=e.i(81323);function e$(e){let t,a=(0,n.c)(2);return a[0]!==e?(t=(0,r.jsx)(ej,{className:eq.default.AccordionGroup,...e}),a[0]=e,a[1]=t):t=a[1],t}function eK(e){let t,a,o,i,l=(0,n.c)(9),{value:s,label:c,children:u}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(eV,{className:eq.default.TriggerIcon}),l[0]=t):t=l[0],l[1]!==c?(a=(0,r.jsxs)(eG,{className:eq.default.Trigger,children:[t," ",c]}),l[1]=c,l[2]=a):a=l[2],l[3]!==u?(o=(0,r.jsx)(eH,{className:eq.default.Content,children:(0,r.jsx)("div",{className:eq.default.Body,children:u})}),l[3]=u,l[4]=o):o=l[4],l[5]!==a||l[6]!==o||l[7]!==s?(i=(0,r.jsxs)(eA,{value:s,children:[a,o]}),l[5]=a,l[6]=o,l[7]=s,l[8]=i):i=l[8],i}var eQ=e.i(65883),eY=e.i(21025),eX=e.i(92224),eZ=e.i(91996);let eJ=["controls","preferences","audio"];function e0(e){let t,o,i,l,s,c,u,d,f,p,v,x,y,b,S,w,j,M,N,R,L,F,E,B,P,A,z,U,G,W,H,O,V,q,$,K,Q,Y,X,Z,J,ee,et,er,en,ea,eo,ei,el,es,ec,eu,ed,em,ef,eh,ep,eg,ev,ex,ey,eb,e_,eS,ew,eC,ej,eM,ek,eT,eN,eR,eD=(0,n.c)(169),{missionName:eL,missionType:eF,onOpenMapInfo:eI,onOpenServerBrowser:eE,onChooseMap:eB,onCancelChoosingMap:eP,choosingMap:eA,cameraRef:ez,invalidateRef:eU}=e,eG=(0,eY.useTouchDevice)(),eW=(0,eX.useDataSource)(),eH=(0,T.useRecording)(),eO=(0,eX.useMissionName)(),eV="demo"===eW||"live"===eW?eO:eL;eD[0]!==eV?(t=!!eV&&(0,eZ.hasMission)(eV),eD[0]=eV,eD[1]=t):t=eD[1];let eq=t,e0=(0,k.useLiveSelector)(e1),{fogEnabled:e2,setFogEnabled:e3,fov:e5,setFov:e4,audioEnabled:e6,setAudioEnabled:e8,audioVolume:e7,setAudioVolume:e9,animationEnabled:te,setAnimationEnabled:tt}=(0,_.useSettings)(),{speedMultiplier:tr,setSpeedMultiplier:tn,touchMode:ta,setTouchMode:to,invertScroll:ti,setInvertScroll:tl,invertDrag:ts,setInvertDrag:tc,invertJoystick:tu,setInvertJoystick:td}=(0,_.useControls)(),{debugMode:tm,setDebugMode:tf,renderOnDemand:th,setRenderOnDemand:tp}=(0,_.useDebug)(),[tg,tv]=(0,a.useState)(!1),tx=(0,a.useRef)(null),ty=(0,a.useRef)(null),tb=(0,a.useRef)(null);eD[2]!==tg?(o=()=>{tg&&tx.current?.focus()},i=[tg],eD[2]=tg,eD[3]=o,eD[4]=i):(o=eD[3],i=eD[4]),(0,a.useEffect)(o,i),eD[5]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{let t=e.relatedTarget;t&&tb.current?.contains(t)||tv(!1)},eD[5]=l):l=eD[5];let t_=l;eD[6]===Symbol.for("react.memo_cache_sentinel")?(s=e=>{"Escape"===e.key&&(tv(!1),ty.current?.focus())},eD[6]=s):s=eD[6];let tS=s,tw="map"===eW&&!eH||eA;eD[7]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(m,{}),u=(0,r.jsx)("span",{className:eQ.default.ButtonLabel,children:"Explore"}),d=(0,r.jsx)("span",{className:eQ.default.ButtonHint,children:"Browse maps"}),eD[7]=c,eD[8]=u,eD[9]=d):(c=eD[7],u=eD[8],d=eD[9]),eD[10]!==eB||eD[11]!==tw?(f=(0,r.jsxs)("button",{type:"button",className:eQ.default.IconButton,"data-active":tw,onClick:eB,children:[c,u,d]}),eD[10]=eB,eD[11]=tw,eD[12]=f):f=eD[12];let tC=!eA&&eH?.source==="demo";eD[13]!==eA||eD[14]!==eP||eD[15]!==tC?(p=(0,r.jsx)(D,{isActive:tC,choosingMap:eA,onCancelChoosingMap:eP}),eD[13]=eA,eD[14]=eP,eD[15]=tC,eD[16]=p):p=eD[16],eD[17]!==eA||eD[18]!==e0||eD[19]!==eE?(v=eE&&(0,r.jsx)(I,{isActive:!eA&&e0,onOpenServerBrowser:eE}),eD[17]=eA,eD[18]=e0,eD[19]=eE,eD[20]=v):v=eD[20],eD[21]!==f||eD[22]!==p||eD[23]!==v?(x=(0,r.jsxs)("div",{className:eQ.default.ButtonGroup,children:[f,p,v]}),eD[21]=f,eD[22]=p,eD[23]=v,eD[24]=x):x=eD[24];let tj=!eq;eD[25]!==ez||eD[26]!==eL||eD[27]!==eF||eD[28]!==tj?(y=(0,r.jsx)(C,{missionName:eL,missionType:eF,cameraRef:ez,disabled:tj}),eD[25]=ez,eD[26]=eL,eD[27]=eF,eD[28]=tj,eD[29]=y):y=eD[29];let tM=!eq;eD[30]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(g,{}),S=(0,r.jsx)("span",{className:eQ.default.ButtonLabel,children:"Show map info"}),eD[30]=b,eD[31]=S):(b=eD[30],S=eD[31]),eD[32]!==eI||eD[33]!==tM?(w=(0,r.jsxs)("button",{type:"button",className:eQ.default.MapInfoButton,"aria-label":"Show map info",onClick:eI,disabled:tM,children:[b,S]}),eD[32]=eI,eD[33]=tM,eD[34]=w):w=eD[34],eD[35]!==x||eD[36]!==y||eD[37]!==w?(j=(0,r.jsxs)("div",{className:eQ.default.Tools,children:[x,y,w]}),eD[35]=x,eD[36]=y,eD[37]=w,eD[38]=j):j=eD[38],eD[39]===Symbol.for("react.memo_cache_sentinel")?(M=(0,r.jsx)("label",{htmlFor:"speedInput",children:"Fly speed"}),eD[39]=M):M=eD[39],eD[40]!==tr?(N=Math.round(100*tr),eD[40]=tr,eD[41]=N):N=eD[41],eD[42]!==tn?(R=e=>tn(parseFloat(e.target.value)/100),eD[42]=tn,eD[43]=R):R=eD[43],eD[44]!==N||eD[45]!==R?(L=(0,r.jsx)("input",{id:"speedInput",type:"range",min:1,max:100,step:1,value:N,onChange:R}),eD[44]=N,eD[45]=R,eD[46]=L):L=eD[46];let tk=!1===eG?" Use your scroll wheel or trackpad to adjust while flying.":"";return eD[47]!==tk?(F=(0,r.jsxs)("p",{className:eQ.default.Description,children:["How fast you move in free-flying mode.",tk]}),eD[47]=tk,eD[48]=F):F=eD[48],eD[49]!==L||eD[50]!==F?(E=(0,r.jsxs)("div",{className:eQ.default.Field,children:[M,L,F]}),eD[49]=L,eD[50]=F,eD[51]=E):E=eD[51],eD[52]!==eG||eD[53]!==to||eD[54]!==ta?(B=eG?(0,r.jsxs)("div",{className:eQ.default.Field,children:[(0,r.jsx)("label",{htmlFor:"touchModeInput",children:"Joystick"})," ",(0,r.jsxs)("select",{id:"touchModeInput",value:ta,onChange:e=>to(e.target.value),children:[(0,r.jsx)("option",{value:"dualStick",children:"Dual stick"}),(0,r.jsx)("option",{value:"moveLookStick",children:"Single stick"})]}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Single stick has a unified move + look control. Dual stick has independent move + look."})]}):null,eD[52]=eG,eD[53]=to,eD[54]=ta,eD[55]=B):B=eD[55],eD[56]!==ti||eD[57]!==eG||eD[58]!==tl?(P=!1===eG?(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertScroll",type:"checkbox",checked:ti,onChange:e=>{tl(e.target.checked)}}),(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertScroll",children:"Invert scroll direction"}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse which scroll direction increases and decreases fly speed."})]}):null,eD[56]=ti,eD[57]=eG,eD[58]=tl,eD[59]=P):P=eD[59],eD[60]!==tu||eD[61]!==eG||eD[62]!==td?(A=eG?(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[(0,r.jsx)("input",{id:"invertJoystick",type:"checkbox",checked:tu,onChange:e=>{td(e.target.checked)}}),(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertJoystick",children:"Invert joystick direction"}),(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse joystick look direction."})]}):null,eD[60]=tu,eD[61]=eG,eD[62]=td,eD[63]=A):A=eD[63],eD[64]!==tc?(z=e=>{tc(e.target.checked)},eD[64]=tc,eD[65]=z):z=eD[65],eD[66]!==ts||eD[67]!==z?(U=(0,r.jsx)("input",{id:"invertDrag",type:"checkbox",checked:ts,onChange:z}),eD[66]=ts,eD[67]=z,eD[68]=U):U=eD[68],eD[69]===Symbol.for("react.memo_cache_sentinel")?(G=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"invertDrag",children:"Invert drag direction"}),W=(0,r.jsx)("p",{className:eQ.default.Description,children:"Reverse how dragging the viewport aims the camera."}),eD[69]=G,eD[70]=W):(G=eD[69],W=eD[70]),eD[71]!==U?(H=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[U,G,W]}),eD[71]=U,eD[72]=H):H=eD[72],eD[73]!==E||eD[74]!==B||eD[75]!==P||eD[76]!==A||eD[77]!==H?(O=(0,r.jsxs)(eK,{value:"controls",label:"Controls",children:[E,B,P,A,H]}),eD[73]=E,eD[74]=B,eD[75]=P,eD[76]=A,eD[77]=H,eD[78]=O):O=eD[78],eD[79]===Symbol.for("react.memo_cache_sentinel")?(V=(0,r.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),eD[79]=V):V=eD[79],eD[80]!==e5?(q=(0,r.jsxs)("output",{htmlFor:"fovInput",children:[e5,"°"]}),eD[80]=e5,eD[81]=q):q=eD[81],eD[82]!==e4?($=e=>e4(parseInt(e.target.value)),eD[82]=e4,eD[83]=$):$=eD[83],eD[84]!==e5||eD[85]!==$?(K=(0,r.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:e5,onChange:$}),eD[84]=e5,eD[85]=$,eD[86]=K):K=eD[86],eD[87]!==q||eD[88]!==K?(Q=(0,r.jsx)(eK,{value:"preferences",label:"Preferences",children:(0,r.jsxs)("div",{className:eQ.default.Field,children:[V,(0,r.jsxs)("div",{className:eQ.default.Control,children:[q,K]})]})}),eD[87]=q,eD[88]=K,eD[89]=Q):Q=eD[89],eD[90]!==e8?(Y=e=>{e8(e.target.checked)},eD[90]=e8,eD[91]=Y):Y=eD[91],eD[92]!==e6||eD[93]!==Y?(X=(0,r.jsx)("input",{id:"audioInput",type:"checkbox",checked:e6,onChange:Y}),eD[92]=e6,eD[93]=Y,eD[94]=X):X=eD[94],eD[95]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"audioInput",children:"Enable audio"}),eD[95]=Z):Z=eD[95],eD[96]!==X?(J=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[X,Z]}),eD[96]=X,eD[97]=J):J=eD[97],eD[98]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,r.jsx)("label",{htmlFor:"volumeInput",children:"Master volume"}),eD[98]=ee):ee=eD[98],eD[99]!==e7?(et=Math.round(100*e7),eD[99]=e7,eD[100]=et):et=eD[100],eD[101]!==et?(er=(0,r.jsxs)("output",{htmlFor:"volumeInput",children:[et,"%"]}),eD[101]=et,eD[102]=er):er=eD[102],eD[103]!==e9?(en=e=>e9(parseFloat(e.target.value)),eD[103]=e9,eD[104]=en):en=eD[104],eD[105]!==e7||eD[106]!==en?(ea=(0,r.jsx)("input",{id:"volumeInput",type:"range",min:0,max:1,step:.05,value:e7,onChange:en}),eD[105]=e7,eD[106]=en,eD[107]=ea):ea=eD[107],eD[108]!==er||eD[109]!==ea?(eo=(0,r.jsxs)("div",{className:eQ.default.Field,children:[ee,(0,r.jsxs)("div",{className:eQ.default.Control,children:[er,ea]})]}),eD[108]=er,eD[109]=ea,eD[110]=eo):eo=eD[110],eD[111]!==J||eD[112]!==eo?(ei=(0,r.jsxs)(eK,{value:"audio",label:"Audio",children:[J,eo]}),eD[111]=J,eD[112]=eo,eD[113]=ei):ei=eD[113],eD[114]!==e3?(el=e=>{e3(e.target.checked)},eD[114]=e3,eD[115]=el):el=eD[115],eD[116]!==e2||eD[117]!==el?(es=(0,r.jsx)("input",{id:"fogInput",type:"checkbox",checked:e2,onChange:el}),eD[116]=e2,eD[117]=el,eD[118]=es):es=eD[118],eD[119]===Symbol.for("react.memo_cache_sentinel")?(ec=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"fogInput",children:"Enable fog"}),eD[119]=ec):ec=eD[119],eD[120]!==es?(eu=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[es,ec]}),eD[120]=es,eD[121]=eu):eu=eD[121],eD[122]!==tt?(ed=e=>{tt(e.target.checked)},eD[122]=tt,eD[123]=ed):ed=eD[123],eD[124]!==te||eD[125]!==ed?(em=(0,r.jsx)("input",{id:"animationInput",type:"checkbox",checked:te,onChange:ed}),eD[124]=te,eD[125]=ed,eD[126]=em):em=eD[126],eD[127]===Symbol.for("react.memo_cache_sentinel")?(ef=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"animationInput",children:"Enable animations"}),eD[127]=ef):ef=eD[127],eD[128]!==em?(eh=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[em,ef]}),eD[128]=em,eD[129]=eh):eh=eD[129],eD[130]!==eu||eD[131]!==eh?(ep=(0,r.jsxs)(eK,{value:"graphics",label:"Graphics",children:[eu,eh]}),eD[130]=eu,eD[131]=eh,eD[132]=ep):ep=eD[132],eD[133]!==tf?(eg=e=>{tf(e.target.checked)},eD[133]=tf,eD[134]=eg):eg=eD[134],eD[135]!==tm||eD[136]!==eg?(ev=(0,r.jsx)("input",{id:"debugInput",type:"checkbox",checked:tm,onChange:eg}),eD[135]=tm,eD[136]=eg,eD[137]=ev):ev=eD[137],eD[138]===Symbol.for("react.memo_cache_sentinel")?(ex=(0,r.jsx)("label",{className:eQ.default.Label,htmlFor:"debugInput",children:"Render debug visuals"}),eD[138]=ex):ex=eD[138],eD[139]!==ev?(ey=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[ev,ex]}),eD[139]=ev,eD[140]=ey):ey=eD[140],eD[141]!==tp?(eb=e=>{tp(e.target.checked)},eD[141]=tp,eD[142]=eb):eb=eD[142],eD[143]!==th||eD[144]!==eb?(e_=(0,r.jsx)("input",{id:"onDemandInput",type:"checkbox",checked:th,onChange:eb}),eD[143]=th,eD[144]=eb,eD[145]=e_):e_=eD[145],eD[146]===Symbol.for("react.memo_cache_sentinel")?(eS=(0,r.jsx)("label",{htmlFor:"onDemandInput",children:"Render on demand "}),eD[146]=eS):eS=eD[146],eD[147]!==eU?(ew=()=>eU.current?.(),eD[147]=eU,eD[148]=ew):ew=eD[148],eD[149]===Symbol.for("react.memo_cache_sentinel")?(eC=(0,r.jsx)(h,{}),eD[149]=eC):eC=eD[149],eD[150]!==ew?(ej=(0,r.jsxs)("div",{className:eQ.default.Label,children:[eS,(0,r.jsx)("button",{type:"button",className:eQ.default.ForceRenderButton,title:"Force render","aria-label":"Force render",onClick:ew,children:eC})]}),eD[150]=ew,eD[151]=ej):ej=eD[151],eD[152]===Symbol.for("react.memo_cache_sentinel")?(eM=(0,r.jsx)("p",{className:eQ.default.Description,children:"Significantly decreases CPU and GPU usage by only rendering frames when requested. Helpful when developing parts of the app unrelated to rendering."}),eD[152]=eM):eM=eD[152],eD[153]!==e_||eD[154]!==ej?(ek=(0,r.jsxs)("div",{className:eQ.default.CheckboxField,children:[e_,ej,eM]}),eD[153]=e_,eD[154]=ej,eD[155]=ek):ek=eD[155],eD[156]!==ey||eD[157]!==ek?(eT=(0,r.jsxs)(eK,{value:"debug",label:"Debug",children:[ey,ek]}),eD[156]=ey,eD[157]=ek,eD[158]=eT):eT=eD[158],eD[159]!==O||eD[160]!==Q||eD[161]!==ei||eD[162]!==ep||eD[163]!==eT?(eN=(0,r.jsx)("div",{className:eQ.default.Accordions,children:(0,r.jsxs)(e$,{type:"multiple",defaultValue:eJ,children:[O,Q,ei,ep,eT]})}),eD[159]=O,eD[160]=Q,eD[161]=ei,eD[162]=ep,eD[163]=eT,eD[164]=eN):eN=eD[164],eD[165]!==tg||eD[166]!==j||eD[167]!==eN?(eR=(0,r.jsx)("div",{className:eQ.default.InspectorControls,children:(0,r.jsx)("div",{ref:tb,children:(0,r.jsxs)("div",{className:eQ.default.Dropdown,ref:tx,id:"settingsPanel",tabIndex:-1,onKeyDown:tS,onBlur:t_,"data-open":tg,children:[j,eN]})})}),eD[165]=tg,eD[166]=j,eD[167]=eN,eD[168]=eR):eR=eD[168],eR}function e1(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var e2=e.i(11889),e3=e.i(56373),e5=e.i(86447),e4=e.i(1559),e6=e.i(78440),e8=e.i(59129),e7=e.i(25998),e9=e.i(18364),te=e.i(68754),tt=e.i(70238),tr=e.i(29402),tn=e.i(97442);let ta=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),to={"missions.vl2":"Official","TR2final105-client.vl2":"Team Rabbit 2","z_mappacks/CTF/Classic_maps_v1.vl2":"Classic","z_mappacks/CTF/DynamixFinalPack.vl2":"Official","z_mappacks/CTF/KryMapPack_b3EDIT.vl2":"KryMapPack","z_mappacks/CTF/S5maps.vl2":"S5","z_mappacks/CTF/S8maps.vl2":"S8","z_mappacks/CTF/TWL-MapPack.vl2":"TWL","z_mappacks/CTF/TWL-MapPackEDIT.vl2":"TWL","z_mappacks/CTF/TWL2-MapPack.vl2":"TWL2","z_mappacks/CTF/TWL2-MapPackEDIT.vl2":"TWL2","z_mappacks/TWL_T2arenaOfficialMaps.vl2":"Arena","z_mappacks/xPack2.vl2":"xPack2","z_mappacks/z_DMP2-V0.6.vl2":"DMP2 (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX.vl2":"DMP (Discord Map Pack)","z_mappacks/zDMP-4.7.3DX-ServerOnly.vl2":"DMP (Discord Map Pack)"},ti={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},tl=(0,eZ.getMissionList)().filter(e=>!ta.has(e)).map(e=>{let t,r=(0,eZ.getMissionInfo)(e),[n]=(0,eZ.getSourceAndPath)(r.resourcePath),a=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",o=to[n]??ti[a]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:o,missionTypes:r.missionTypes}}),ts=new Map(tl.map(e=>[e.missionName,e])),tc=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,tr.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,tr.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(tl),tu="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function td(e){let t,a,o,i,l,s=(0,n.c)(12),{mission:c}=e,u=c.displayName||c.missionName;return s[0]!==u?(t=(0,r.jsx)("span",{className:tn.default.ItemName,children:u}),s[0]=u,s[1]=t):t=s[1],s[2]!==c.missionTypes?(a=c.missionTypes.length>0&&(0,r.jsx)("span",{className:tn.default.ItemTypes,children:c.missionTypes.map(tm)}),s[2]=c.missionTypes,s[3]=a):a=s[3],s[4]!==t||s[5]!==a?(o=(0,r.jsxs)("span",{className:tn.default.ItemHeader,children:[t,a]}),s[4]=t,s[5]=a,s[6]=o):o=s[6],s[7]!==c.missionName?(i=(0,r.jsx)("span",{className:tn.default.ItemMissionName,children:c.missionName}),s[7]=c.missionName,s[8]=i):i=s[8],s[9]!==o||s[10]!==i?(l=(0,r.jsxs)(r.Fragment,{children:[o,i]}),s[9]=o,s[10]=i,s[11]=l):l=s[11],l}function tm(e){return(0,r.jsx)("span",{className:tn.default.ItemType,"data-mission-type":e,children:e},e)}function tf(e){let t,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_=(0,n.c)(48),{value:S,missionType:w,onChange:C,disabled:j,autoFocus:M}=e,[k,T]=(0,a.useState)(""),N=(0,a.useRef)(null),R=(0,a.useRef)(w);_[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,a.startTransition)(()=>T(e))},_[0]=t):t=_[0];let D=(0,e9.useComboboxStore)({resetValueOnHide:!0,selectedValue:S,setSelectedValue:e=>{if(e){let t=R.current,r=(0,eZ.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),C({missionName:e,missionType:t}),N.current?.blur()}},setValue:t}),L=(0,te.useStoreState)(D,"open");_[1]!==D?(o=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),N.current?.focus(),D.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},i=[D],_[1]=D,_[2]=o,_[3]=i):(o=_[2],i=_[3]),(0,a.useEffect)(o,i),_[4]!==S?(l=ts.get(S),_[4]=S,_[5]=l):l=_[5];let F=l;e:{let e,t;if(!k){let e;_[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:tc},_[6]=e):e=_[6],s=e;break e}_[7]!==k?(e=(0,tt.matchSorter)(tl,k,{keys:["displayName","missionName","missionTypes","groupName"]}),_[7]=k,_[8]=e):e=_[8];let r=e;_[9]!==r?(t={type:"flat",missions:r},_[9]=r,_[10]=t):t=_[10],s=t}let I=s,E=F?F.displayName||F.missionName:S,B="flat"===I.type?0===I.missions.length:0===I.groups.length,P=e=>(0,r.jsx)(e3.ComboboxItem,{value:e.missionName,className:tn.default.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(R.current=r,e.missionName===S&&C({missionName:e.missionName,missionType:r})):R.current=null}else R.current=null},children:(0,r.jsx)(td,{mission:e})},e.missionName),A=e6.ComboboxProvider,z=L?"visible":"hidden";_[11]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)("div",{className:tn.default.Backdrop}),_[11]=c):c=_[11],_[12]!==z?(u=(0,r.jsx)(a.Activity,{mode:z,children:c}),_[12]=z,_[13]=u):u=_[13];let U=F?void 0:"Choose a map…";_[14]!==D?(d=()=>{try{document.exitPointerLock()}catch{}D.show()},m=e=>{"Escape"!==e.key||D.getState().open||N.current?.blur()},_[14]=D,_[15]=d,_[16]=m):(d=_[15],m=_[16]),_[17]!==M||_[18]!==j||_[19]!==d||_[20]!==m||_[21]!==U?(f=(0,r.jsx)(e2.Combobox,{ref:N,autoSelect:!0,autoFocus:M,disabled:j,placeholder:U,className:tn.default.Input,onFocus:d,onKeyDown:m}),_[17]=M,_[18]=j,_[19]=d,_[20]=m,_[21]=U,_[22]=f):f=_[22],_[23]!==E||_[24]!==w||_[25]!==F?(h=F&&(0,r.jsxs)("div",{className:tn.default.SelectedValue,children:[(0,r.jsx)("span",{className:tn.default.SelectedName,children:E}),w&&(0,r.jsx)("span",{className:tn.default.ItemType,"data-mission-type":w,children:w})]}),_[23]=E,_[24]=w,_[25]=F,_[26]=h):h=_[26],_[27]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)("kbd",{className:tn.default.Shortcut,children:tu?"⌘K":"^K"}),_[27]=p):p=_[27],_[28]!==f||_[29]!==h?(g=(0,r.jsxs)("div",{className:tn.default.InputWrapper,children:[f,h,p]}),_[28]=f,_[29]=h,_[30]=g):g=_[30];let G=e4.ComboboxPopover,W=tn.default,H=e5.ComboboxList,O=tn.default,V="flat"===I.type?I.missions.map(P):I.groups.map(e=>{let[t,n]=e;return t?(0,r.jsxs)(e8.ComboboxGroup,{className:tn.default.Group,children:[(0,r.jsx)(e7.ComboboxGroupLabel,{className:tn.default.GroupLabel,children:t}),n.map(P)]},t):(0,r.jsx)(a.Fragment,{children:n.map(P)},"ungrouped")});return _[31]!==B?(v=B&&(0,r.jsx)("div",{className:tn.default.NoResults,children:"No missions found"}),_[31]=B,_[32]=v):v=_[32],_[33]!==H||_[34]!==O.List||_[35]!==V||_[36]!==v?(x=(0,r.jsxs)(H,{className:O.List,children:[V,v]}),_[33]=H,_[34]=O.List,_[35]=V,_[36]=v,_[37]=x):x=_[37],_[38]!==G||_[39]!==W.Popover||_[40]!==x?(y=(0,r.jsx)(G,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:W.Popover,children:x}),_[38]=G,_[39]=W.Popover,_[40]=x,_[41]=y):y=_[41],_[42]!==A||_[43]!==D||_[44]!==g||_[45]!==y||_[46]!==u?(b=(0,r.jsxs)(A,{store:D,children:[u,g,y]}),_[42]=A,_[43]=D,_[44]=g,_[45]=y,_[46]=u,_[47]=b):b=_[47],b}var th=e.i(58647);function tp(e){return(0,d.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 6-6 8h12zM6 16h12v2H6z"},child:[]}]})(e)}var tg=e.i(16964);function tv(){let e,t,a,o,i,l,s=(0,n.c)(24),c=(0,eX.useDataSource)(),u=(0,eX.useMissionDisplayName)(),d=(0,eX.useMissionType)(),m=(0,eX.useMissionTypeDisplayName)(),f=(0,eX.useServerDisplayName)(),h=(0,eX.useRecorderName)(),g=(0,eX.useRecordingDate)(),[v,x]=g?g.split(" "):[null,null],y="live"===c,b=(0,T.useRecording)(),_=(0,k.useLiveSelector)(tb),S=tg.default;s[0]!==u||s[1]!==d||s[2]!==m?(e=u&&d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:tg.default.MissionName,children:u}),d&&(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)("span",{className:tg.default.MissionType,"data-mission-type":d,children:"LCTF"===m?"LCTF":d})]})]}):null,s[0]=u,s[1]=d,s[2]=m,s[3]=e):e=s[3],s[4]!==e?(t=(0,r.jsx)("div",{className:tg.default.MissionInfo,children:e}),s[4]=e,s[5]=t):t=s[5];let w=tg.default,C=y?_?h?(0,r.jsxs)("div",{className:tg.default.Attribution,children:["Connected as"," ",(0,r.jsx)("span",{className:tg.default.PlayerName,children:h})]}):null:(0,r.jsx)("div",{className:tg.default.Error,children:"Disconnected"}):h&&g?(0,r.jsxs)("div",{className:tg.default.Attribution,children:["Recorded by ",(0,r.jsx)("span",{className:tg.default.PlayerName,children:h})," ","on"," ",(0,r.jsx)("span",{className:tg.default.RecordingDate,children:v.replace(/-/g," ")})," ","at ",(0,r.jsx)("span",{className:tg.default.RecordingDate,children:x})]}):null;return s[6]!==f?(a=f?(0,r.jsxs)("div",{className:tg.default.ServerInfo,children:["Server: ",(0,r.jsx)("span",{className:tg.default.ServerName,children:f})]}):null,s[6]=f,s[7]=a):a=s[7],s[8]!==w.Metadata||s[9]!==C||s[10]!==a?(o=(0,r.jsxs)("div",{className:w.Metadata,children:[C,a]}),s[8]=w.Metadata,s[9]=C,s[10]=a,s[11]=o):o=s[11],s[12]!==c||s[13]!==tx||s[14]!==ty||s[15]!==y||s[16]!==_||s[17]!==b?(i="demo"===c?(0,r.jsx)("button",{type:"button",className:tg.default.ActionButton,title:"Unload demo","aria-label":"Unload demo",onClick:ty,disabled:!b,children:(0,r.jsx)(tp,{className:tg.default.EjectIcon})}):y?(0,r.jsx)("button",{type:"button",className:tg.default.ActionButton,title:"Disconnect","aria-label":"Disconnect",onClick:tx,disabled:!_,children:(0,r.jsx)(p,{})}):null,s[12]=c,s[13]=tx,s[14]=ty,s[15]=y,s[16]=_,s[17]=b,s[18]=i):i=s[18],s[19]!==S.Header||s[20]!==t||s[21]!==o||s[22]!==i?(l=(0,r.jsxs)("div",{className:S.Header,children:[t,o,i]}),s[19]=S.Header,s[20]=t,s[21]=o,s[22]=i,s[23]=l):l=s[23],l}function tx(){let e=k.liveConnectionStore.getState();e.disconnectServer(),e.disconnectRelay(),th.engineStore.getState().setRecording(null)}function ty(){th.engineStore.getState().setRecording(null)}function tb(e){return"connected"===e.gameStatus||"authenticating"===e.gameStatus}var t_=e.i(31067),tS=e.i(15080),tw=e.i(71753),tC=e.i(90072);let tj=a.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:o,...i},l)=>{let s=(0,tS.useThree)(({set:e})=>e),c=(0,tS.useThree)(({camera:e})=>e),u=(0,tS.useThree)(({size:e})=>e),d=a.useRef(null);a.useImperativeHandle(l,()=>d.current,[]);let m=a.useRef(null),f=function(e,t,r){let n=(0,tS.useThree)(e=>e.size),o=(0,tS.useThree)(e=>e.viewport),i="number"==typeof e?e:n.width*o.dpr,l=n.height*o.dpr,s=("number"==typeof e?void 0:e)||{},{samples:c=0,depth:u,...d}=s,m=null!=u?u:s.depthBuffer,f=a.useMemo(()=>{let e=new tC.WebGLRenderTarget(i,l,{minFilter:tC.LinearFilter,magFilter:tC.LinearFilter,type:tC.HalfFloatType,...d});return m&&(e.depthTexture=new tC.DepthTexture(i,l,tC.FloatType)),e.samples=c,e},[]);return a.useLayoutEffect(()=>{f.setSize(i,l),c&&(f.samples=c)},[c,f,i,l]),a.useEffect(()=>()=>f.dispose(),[]),f}(t);a.useLayoutEffect(()=>{i.manual||(d.current.aspect=u.width/u.height)},[u,i]),a.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let h=0,p=null,g="function"==typeof o;return(0,tw.useFrame)(t=>{g&&(r===1/0||h<r)&&(m.current.visible=!1,t.gl.setRenderTarget(f),p=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,d.current),t.scene.background=p,t.gl.setRenderTarget(null),m.current.visible=!0,h++)}),a.useLayoutEffect(()=>{if(n)return s(()=>({camera:d.current})),()=>s(()=>({camera:c}))},[d,n,s]),a.createElement(a.Fragment,null,a.createElement("perspectiveCamera",(0,t_.default)({ref:d},i),!g&&o),a.createElement("group",{ref:m},g&&o(f.texture)))});function tM(){let e,t,a=(0,n.c)(3),{fov:o}=(0,_.useSettings)();return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],a[0]=e):e=a[0],a[1]!==o?(t=(0,r.jsx)(tj,{makeDefault:!0,position:e,fov:o}),a[1]=o,a[2]=t):t=a[2],t}var tk=e.i(51434);let tT=(0,a.createContext)(null);function tN(){let e=(0,a.useContext)(tT);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function tR({children:e}){let t=(0,tS.useThree)(e=>e.camera),[n,o]=(0,a.useState)(-1),[i,l]=(0,a.useState)({}),[s,c]=(0,a.useState)(()=>({initialized:!1,position:null,quarternion:null})),u=(0,a.useCallback)(e=>{l(t=>({...t,[e.id]:e}))},[]),d=(0,a.useCallback)(e=>{l(t=>{let{[e.id]:r,...n}=t;return n})},[]),m=Object.keys(i).length,f=(0,a.useCallback)(e=>{if(e>=0&&e<m){o(e);let r=Object.keys(i)[e],n=i[r];t.position.copy(n.position);let a=new tC.Quaternion().setFromAxisAngle(new tC.Vector3(0,1,0),-Math.PI/2);t.quaternion.copy(n.rotation).multiply(a)}},[t,m,i]),h=(0,a.useCallback)(()=>{f(m?(n+1)%m:-1)},[m,n,f]);(0,a.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),a=r.split(",").map(e=>parseFloat(e));c({initialized:!0,position:new tC.Vector3(...n),quarternion:new tC.Quaternion(...a)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,a.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,a.useEffect)(()=>{s.initialized&&!s.position&&m>0&&-1===n&&f(0)},[m,f,n,s]);let p=(0,a.useMemo)(()=>({registerCamera:u,unregisterCamera:d,nextCamera:h,setCameraIndex:f,cameraCount:m}),[u,d,h,f,m]);return 0===m&&-1!==n&&o(-1),(0,r.jsx)(tT.Provider,{value:p,children:e})}var tD=e.i(93784),tL=e.i(65349),tF=e.i(51475),tI=e.i(89119);let tE=(0,M.createLogger)("InputConsumer"),tB=Math.PI/2-.01,tP=1/32,tA=2*Math.PI;function tz(e){return(Math.round(e/tA*65536)<<16>>16)*tA/65536}let tU=new tC.Vector3,tG=new tC.Vector3,tW=new tC.Vector3,tH=new tC.Euler(0,0,0,"YXZ");function tO(e,t,r,n,a,o,i){if(0===n&&0===a&&0===o)return;let l=Math.sin(t),s=Math.cos(t),c=Math.sin(r),u=Math.cos(r),d=i*tP;e.x+=(s*n+l*u*a+l*c*o)*d,e.y+=(-l*n+s*u*a+s*c*o)*d,e.z+=(-c*a+u*o)*d}function tV(){let{moveQueue:e,mode:t,setMode:r}=(0,tL.useInputContext)(),n=(0,k.useLiveSelector)(e=>e.adapter),o=(0,k.useLiveSelector)(e=>e.gameStatus),i=(0,k.useLiveSelector)(e=>e.sendMoves),l=(0,th.useEngineStoreApi)(),s=(0,tS.useThree)(e=>e.camera),c=(0,tF.useGetTickFraction)(),u=(0,a.useRef)(null),d=(0,a.useRef)([]),m=(0,a.useRef)(0),f=(0,a.useRef)(0),h=(0,a.useRef)(null),p=(0,a.useRef)(0),g=(0,a.useRef)(0),v=(0,a.useRef)({x:0,y:0,z:0}),x=(0,a.useRef)(0),y=(0,a.useRef)(0),b=(0,a.useRef)({x:0,y:0,z:0}),_=(0,a.useRef)(!1),S=(0,a.useRef)({x:0,y:0,z:0}),w=(0,a.useRef)({x:0,y:0,z:0}),C=(0,a.useRef)(!1),j=(0,a.useRef)(null),M=(0,a.useRef)(0),T=(0,a.useRef)(0),N=(0,a.useRef)(0),R=(0,a.useRef)(0),D=(0,a.useRef)(0),L=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),F=(0,a.useRef)([!1,!1,!1,!1,!1,!1]),I=!!n&&("connected"===o||"authenticating"===o);return(0,a.useEffect)(()=>{if(I&&n){if(u.current===n)return;tE.info("wiring adapter to engine store");let e=k.liveConnectionStore.getState(),t={source:"live",duration:1/0,missionName:e.mapName??null,gameType:null,serverDisplayName:e.serverName??null,recorderName:e.warriorName??null,recordingDate:null,streamingPlayback:n};l.getState().setRecording(t),l.getState().setPlaybackStatus("playing"),u.current=n,_.current=!1,C.current=!1,j.current=null,d.current.length=0,m.current=0,f.current=0,h.current=null,r("fly")}else if(!I&&u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null,_.current=!1,C.current=!1,j.current=null,d.current.length=0,r("local")}},[I,n,l,r]),(0,tF.useTick)(()=>{if(!u.current||"connected"!==o)return;let e=M.current,t=T.current;M.current=0,T.current=0;let n=N.current,a=R.current,l=D.current;N.current=0,R.current=0,D.current=0;let s=[...L.current];L.current.fill(!1),s[2]&&!F.current[2]&&(u.current.toggleObserverMode(),tE.info("observer mode: %s",u.current.observerMode),r("follow"===u.current.observerMode?"follow":"fly")),F.current=s;let c=tz(e),f=tz(t);p.current+=c-e,g.current+=f-t,x.current=p.current,y.current=g.current,b.current={...v.current};let h=p.current-c,_=g.current-f;tO(v.current,h,_,n,a,l,80),s[1]=!0;let k=m.current++,I=d.current;I.push({moveIndex:k,move:{x:n,y:a,z:l,yaw:e,pitch:t,roll:0,trigger:s,freeLook:!1},yaw:c,pitch:f,x:n,y:a,z:l}),I.length>45&&I.splice(0,I.length-45);let E=u.current.lastMoveAck;for(;I.length>0&&I[0].moveIndex<E;)I.shift();if(I.length>0){let e=I.slice(0,31);i(e.map(e=>e.move),e[0].moveIndex)}let B=u.current.getSnapshot();if(B!==j.current){j.current=B;let e=B?.camera;if(e?.orbitTargetId){let t=B.entities.find(t=>t.id===e.orbitTargetId);t?.position&&(S.current={...w.current},w.current={x:t.position[0],y:t.position[1],z:t.position[2]},C.current||(S.current={...w.current},C.current=!0))}}}),(0,tw.useFrame)((r,n)=>{let a=e.current;if(a.length>0){let t=0,r=0,n=0,c=0,d=0,f=0,h=[!1,!1,!1,!1,!1,!1];for(let e of a){t+=e.deltaYaw,r+=e.deltaPitch,n=e.x,c=e.y,d=e.z,f+=e.delta;for(let t=0;t<e.triggers.length;t++)e.triggers[t]&&(h[t]=!0)}if(e.current.length=0,I&&u.current&&"connected"===o){M.current+=t,T.current+=r,N.current=n,R.current=c,D.current=d;for(let e=0;e<h.length;e++)h[e]&&(L.current[e]=!0);p.current+=t,g.current=Math.max(-tI.MAX_PITCH,Math.min(tI.MAX_PITCH,g.current+r))}else{let e=tD.streamPlaybackStore.getState();if(e.playback&&!e.freeFlyCamera)return;var i=s,l=t,m=r,j=n,k=c,F=d,E=f;if((0!==l||0!==m)&&(tH.setFromQuaternion(i.quaternion,"YXZ"),tH.y-=l,tH.x-=m,tH.x=Math.max(-tB,Math.min(tB,tH.x)),i.quaternion.setFromEuler(tH)),0!==j||0!==k||0!==F){i.getWorldDirection(tU),tU.normalize(),tG.crossVectors(i.up,tU).normalize(),tW.set(0,0,0),0!==k&&tW.addScaledVector(tU,k),0!==j&&tW.addScaledVector(tG,-j),0!==F&&(tW.y+=F);let e=tW.length();e>0&&(tW.multiplyScalar(Math.min(1,e)/e*300*E),i.position.add(tW))}return}}if(!I||!u.current||"connected"!==o)return;let B=u.current,P=B.getSnapshot(),A=P?.camera;if(A&&A!==h.current&&"number"==typeof A.yaw&&"number"==typeof A.pitch){h.current=A;let e=B.lastMoveAck;if(e>f.current){f.current=e;let t=d.current;for(;t.length>0&&t[0].moveIndex<e;)t.shift()}p.current=A.yaw,g.current=A.pitch,v.current={x:A.position[0],y:A.position[1],z:A.position[2]};for(let e of d.current)tO(v.current,p.current,g.current,e.x,e.y,e.z,80),p.current+=e.yaw,g.current=Math.max(-tI.MAX_PITCH,Math.min(tI.MAX_PITCH,g.current+e.pitch));if(p.current+=M.current,g.current=Math.max(-tI.MAX_PITCH,Math.min(tI.MAX_PITCH,g.current+T.current)),x.current=p.current,y.current=g.current,b.current={...v.current},_.current=!0,A.orbitTargetId&&!C.current){let e=P.entities.find(e=>e.id===A.orbitTargetId);if(e?.position){let t={x:e.position[0],y:e.position[1],z:e.position[2]};w.current=t,S.current={...t},C.current=!0}}}if(_.current){if("fly"===t)!function(e,t,r,n,a,o){let i=t.x+(r.x-t.x)*o,l=t.y+(r.y-t.y)*o,s=t.z+(r.z-t.z)*o;e.position.set(l,s,i);let[c,u,d,m]=(0,tI.yawPitchToQuaternion)(n,a);e.quaternion.set(c,u,d,m)}(r.camera,b.current,v.current,p.current,g.current,c());else if("follow"===t){if(!C.current)return;!function(e,t,r,n,a,o,i,l){let s=t.x+(r.x-t.x)*o,c=t.y+(r.y-t.y)*o,u=t.z+(r.z-t.z)*o,d=null!=l&&tD.streamPlaybackStore.getState().entities.get(l)?.renderType==="Player",m=Math.sin(a),f=Math.cos(a),h=Math.sin(n),p=Math.cos(n),g=Math.max(.1,i);e.position.set(c-p*f*g,u+ +!!d+m*g,s-h*f*g);let[v,x,y,b]=(0,tI.yawPitchToQuaternion)(n,a);e.quaternion.set(v,x,y,b)}(r.camera,S.current,w.current,p.current,g.current,c(),A?.orbitDistance??4,A?.orbitTargetId)}}}),(0,a.useEffect)(()=>()=>{if(u.current){let e=l.getState().playback.recording;e?.source==="live"&&l.getState().setRecording(null),u.current=null}},[l]),null}var tq=e.i(77964),t$=e.i(91907),tK=e.i(25947),tQ=e.i(46325),tY=e.i(31999),tX=e.i(89887);function tZ(e){let t,r,o,i,l=(0,n.c)(12),{entity:s}=e,{registerCamera:c,unregisterCamera:u}=tN(),d=(0,a.useId)(),m=s.cameraDataBlock;l[0]!==s.position?(t=s.position?new tC.Vector3(...s.position):new tC.Vector3,l[0]=s.position,l[1]=t):t=l[1];let f=t;l[2]!==s.rotation?(r=s.rotation?new tC.Quaternion(...s.rotation):new tC.Quaternion,l[2]=s.rotation,l[3]=r):r=l[3];let h=r;return l[4]!==m||l[5]!==d||l[6]!==f||l[7]!==c||l[8]!==h||l[9]!==u?(o=()=>{if("Observer"===m){let e={id:d,position:f,rotation:h};return c(e),()=>{u(e)}}},i=[d,m,c,u,f,h],l[4]=m,l[5]=d,l[6]=f,l[7]=c,l[8]=h,l[9]=u,l[10]=o,l[11]=i):(o=l[10],i=l[11]),(0,a.useEffect)(o,i),null}function tJ(e){let t,a=(0,n.c)(3),{entity:o}=e;return a[0]!==o.label||a[1]!==o.position?(t=o.label?(0,r.jsx)(tX.FloatingLabel,{position:o.position,opacity:.6,children:o.label}):null,a[0]=o.label,a[1]=o.position,a[2]=t):t=a[2],t}var t0=e.i(66027),t1=e.i(63318),t2=e.i(12979),t3=e.i(75567),t5=e.i(47071);let t4={value:!0},t6=`
|
||
vec3 terrainLinearToSRGB(vec3 linear) {
|
||
vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055;
|
||
vec3 lower = linear * 12.92;
|
||
return mix(lower, higher, step(vec3(0.0031308), linear));
|
||
}
|
||
|
||
vec3 terrainSRGBToLinear(vec3 srgb) {
|
||
vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4));
|
||
vec3 lower = srgb / 12.92;
|
||
return mix(lower, higher, step(vec3(0.04045), srgb));
|
||
}
|
||
|
||
// Debug grid overlay using screen-space derivatives for sharp, anti-aliased lines
|
||
// Returns 1.0 on grid lines, 0.0 elsewhere
|
||
float terrainDebugGrid(vec2 uv, float gridSize, float lineWidth) {
|
||
vec2 scaledUV = uv * gridSize;
|
||
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
|
||
float line = min(grid.x, grid.y);
|
||
return 1.0 - min(line / lineWidth, 1.0);
|
||
}
|
||
`;var t8=e.i(56893),t7=e.i(47021),t9=e.i(48066);let re={0:32,1:32,2:32,3:32,4:32,5:32},rt=(0,a.memo)(function({displacementMap:e,visibilityMask:t,textureNames:n,alphaTextures:o,detailTextureName:i,lightmap:l}){let{debugMode:s}=(0,_.useDebug)(),c=(0,t8.useAnisotropy)(),u=(0,t5.useTexture)(n.map(e=>(0,t2.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,t3.setupTexture)(e,{anisotropy:c}))}),d=i?(0,t2.textureToUrl)(i):null,m=(0,t5.useTexture)(d??t2.FALLBACK_TEXTURE_URL,e=>{(0,t3.setupTexture)(e,{anisotropy:c})}),f=(0,a.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:a,detailTexture:o=null,lightmap:i=null}){e.uniforms.sunLightPointsDown=t4;let l=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:a[r]??32}}),i&&(e.uniforms.terrainLightmap={value:i}),o&&(e.uniforms.detailTexture={value:o},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include <common>",`#include <common>
|
||
varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include <worldpos_vertex>",`#include <worldpos_vertex>
|
||
vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`)),e.fragmentShader=`
|
||
uniform sampler2D albedo0;
|
||
uniform sampler2D albedo1;
|
||
uniform sampler2D albedo2;
|
||
uniform sampler2D albedo3;
|
||
uniform sampler2D albedo4;
|
||
uniform sampler2D albedo5;
|
||
uniform sampler2D mask0;
|
||
uniform sampler2D mask1;
|
||
uniform sampler2D mask2;
|
||
uniform sampler2D mask3;
|
||
uniform sampler2D mask4;
|
||
uniform sampler2D mask5;
|
||
uniform float tiling0;
|
||
uniform float tiling1;
|
||
uniform float tiling2;
|
||
uniform float tiling3;
|
||
uniform float tiling4;
|
||
uniform float tiling5;
|
||
${n?"uniform sampler2D visibilityMask;":""}
|
||
${i?"uniform sampler2D terrainLightmap;":""}
|
||
uniform bool sunLightPointsDown;
|
||
${o?`uniform sampler2D detailTexture;
|
||
uniform float detailTiling;
|
||
uniform float detailFadeDistance;
|
||
varying vec3 vTerrainWorldPos;`:""}
|
||
|
||
${t6}
|
||
|
||
// Global variable to store shadow factor from RE_Direct for use in output calculation
|
||
float terrainShadowFactor = 1.0;
|
||
`+e.fragmentShader,n){let t="#include <clipping_planes_fragment>";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 <map_fragment>",`
|
||
// Sample base albedo layers (sRGB textures auto-decoded to linear by Three.js)
|
||
vec2 baseUv = vMapUv;
|
||
vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb;
|
||
${l>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""}
|
||
${l>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""}
|
||
${l>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""}
|
||
${l>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""}
|
||
${l>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":""}
|
||
|
||
// Sample alpha masks for all layers (use R channel)
|
||
// Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices),
|
||
// but GPU linear filtering samples at texel centers. This offset aligns them.
|
||
vec2 alphaUv = baseUv + vec2(0.5 / 256.0);
|
||
float a0 = texture2D(mask0, alphaUv).r;
|
||
${l>1?"float a1 = texture2D(mask1, alphaUv).r;":""}
|
||
${l>2?"float a2 = texture2D(mask2, alphaUv).r;":""}
|
||
${l>3?"float a3 = texture2D(mask3, alphaUv).r;":""}
|
||
${l>4?"float a4 = texture2D(mask4, alphaUv).r;":""}
|
||
${l>5?"float a5 = texture2D(mask5, alphaUv).r;":""}
|
||
|
||
// Torque-style additive weighted blending (blender.cc):
|
||
// result = tex0 * alpha0 + tex1 * alpha1 + tex2 * alpha2 + ...
|
||
// Each layer's alpha map defines its contribution weight.
|
||
vec3 blended = c0 * a0;
|
||
${l>1?"blended += c1 * a1;":""}
|
||
${l>2?"blended += c2 * a2;":""}
|
||
${l>3?"blended += c3 * a3;":""}
|
||
${l>4?"blended += c4 * a4;":""}
|
||
${l>5?"blended += c5 * a5;":""}
|
||
|
||
// Assign to diffuseColor before lighting
|
||
vec3 textureColor = blended;
|
||
|
||
${o?`// Detail texture blending (Torque-style multiplicative blend)
|
||
// Sample detail texture at high frequency tiling
|
||
vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb;
|
||
|
||
// Calculate distance-based fade factor using world positions
|
||
// Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance
|
||
float distToCamera = distance(vTerrainWorldPos, cameraPosition);
|
||
float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0);
|
||
|
||
// Torque blending: dst * lerp(1.0, detailTexel, fadeFactor)
|
||
// Detail textures are authored with bright values (~0.8 mean), not 0.5 gray
|
||
// Direct multiplication adds subtle darkening for surface detail
|
||
textureColor *= mix(vec3(1.0), detailColor, detailFade);`:""}
|
||
|
||
// Store blended texture in diffuseColor (still in linear space here)
|
||
// We'll convert to sRGB in the output calculation
|
||
diffuseColor.rgb = textureColor;
|
||
`),i&&(e.fragmentShader=e.fragmentShader.replace("#include <lights_lambert_pars_fragment>",`#include <lights_lambert_pars_fragment>
|
||
|
||
// 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 <lights_fragment_begin>",`#include <lights_fragment_begin>
|
||
// 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 <lights_fragment_end>",`#include <lights_fragment_end>
|
||
// 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 <opaque_fragment>",`// Torque-style terrain lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space
|
||
{
|
||
// Get texture in sRGB space (undo Three.js linear decode)
|
||
vec3 textureSRGB = terrainLinearToSRGB(diffuseColor.rgb);
|
||
|
||
${i?`
|
||
// Sample terrain lightmap for smooth NdotL
|
||
vec2 lightmapUv = vMapUv + vec2(0.5 / 512.0);
|
||
float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r;
|
||
|
||
// Get sun and ambient colors from Three.js lights (these ARE sRGB values from mission file)
|
||
// Three.js interprets them as linear, but the numerical values are preserved
|
||
#if ( NUM_DIR_LIGHTS > 0 )
|
||
vec3 sunColorSRGB = directionalLights[0].color;
|
||
#else
|
||
vec3 sunColorSRGB = vec3(0.7);
|
||
#endif
|
||
vec3 ambientColorSRGB = ambientLightColor;
|
||
|
||
// Torque formula (terrLighting.cc:471-483):
|
||
// lighting = ambient + NdotL * shadowFactor * sunColor
|
||
// Clamp lighting to [0,1] before multiplying by texture
|
||
vec3 lightingSRGB = clamp(ambientColorSRGB + lightmapNdotL * terrainShadowFactor * sunColorSRGB, 0.0, 1.0);
|
||
`:`
|
||
// No lightmap - use simple ambient lighting
|
||
vec3 lightingSRGB = ambientLightColor;
|
||
`}
|
||
|
||
// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space
|
||
vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0);
|
||
|
||
// Convert back to linear for Three.js output pipeline
|
||
outgoingLight = terrainSRGBToLinear(resultSRGB) + totalEmissiveRadiance;
|
||
}
|
||
#include <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`#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 <tonemapping_fragment>`)}({shader:e,baseTextures:u,alphaTextures:o,visibilityMask:t,tiling:re,detailTexture:d?m:null,lightmap:l}),(0,t7.injectCustomFog)(e,t9.globalFogUniforms)},[u,o,t,m,d,l]),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!s,e.needsUpdate=!0)},[s]);let p=`${d?"detail":"nodetail"}-${l?"lightmap":"nolightmap"}`;return(0,r.jsx)("meshLambertMaterial",{ref:h,map:e,depthWrite:!0,side:tC.FrontSide,defines:{DEBUG_MODE:+!!s},onBeforeCompile:f},p)}),rr=(0,a.memo)(function(e){let t,o,i=(0,n.c)(8),{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),i[0]=t):t=i[0],i[1]!==u||i[2]!==d||i[3]!==l||i[4]!==m||i[5]!==c||i[6]!==s?(o=(0,r.jsx)(a.Suspense,{fallback:t,children:(0,r.jsx)(rt,{displacementMap:l,visibilityMask:s,textureNames:c,alphaTextures:u,detailTextureName:d,lightmap:m})}),i[1]=u,i[2]=d,i[3]=l,i[4]=m,i[5]=c,i[6]=s,i[7]=o):o=i[7],o}),rn=(0,a.memo)(function(e){let t,a,o,i=(0,n.c)(15),{tileX:l,tileZ:s,blockSize:c,basePosition:u,textureNames:d,geometry:m,displacementMap:f,visibilityMask:h,alphaTextures:p,detailTextureName:g,lightmap:v,visible:x}=e,y=void 0===x||x,b=c/2,_=u.x+l*c+b,S=u.z+s*c+b;i[0]!==_||i[1]!==S?(t=[_,0,S],i[0]=_,i[1]=S,i[2]=t):t=i[2];let w=t;return i[3]!==p||i[4]!==g||i[5]!==f||i[6]!==v||i[7]!==d||i[8]!==h?(a=(0,r.jsx)(rr,{displacementMap:f,visibilityMask:h,textureNames:d,alphaTextures:p,detailTextureName:g,lightmap:v}),i[3]=p,i[4]=g,i[5]=f,i[6]=v,i[7]=d,i[8]=h,i[9]=a):a=i[9],i[10]!==m||i[11]!==w||i[12]!==a||i[13]!==y?(o=(0,r.jsx)("mesh",{position:w,geometry:m,castShadow:!0,receiveShadow:!0,visible:y,children:a}),i[10]=m,i[11]=w,i[12]=a,i[13]=y,i[14]=o):o=i[14],o});function ra(e){}let ro=(0,M.createLogger)("TerrainBlock");function ri(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,a=r>>16,o=256*n;for(let r=0;r<a;r++){let n=o+e+r;n<t.length&&(t[n]=0)}}let r=new tC.DataTexture(t,256,256,tC.RedFormat,tC.UnsignedByteType);return r.colorSpace=tC.NoColorSpace,r.wrapS=r.wrapT=tC.ClampToEdgeWrapping,r.magFilter=tC.NearestFilter,r.minFilter=tC.NearestFilter,r.needsUpdate=!0,r}let rl=(0,a.memo)(function(e){let t,o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S,w,C,j,M,k,T=(0,n.c)(67),{scene:N}=e,R=N.terrFileName,D=N.squareSize||8,L=N.detailTextureName||void 0,F=256*D,I=(S=(0,eX.useSceneSky)())&&S.visibleDistance>0?S.visibleDistance:600,E=(0,tS.useThree)(rs),B=-(128*D);T[0]!==B?(t={x:B,z:B},T[0]=B,T[1]=t):t=T[1];let P=t;T[2]!==N.emptySquareRuns?(o=N.emptySquareRuns??[],T[2]=N.emptySquareRuns,T[3]=o):o=T[3];let A=o,{data:z}=((M=(0,n.c)(8))[0]!==R?(w={queryKey:["terrain",R],queryFn:()=>(ro.debug("Loading terrain: %s",R),(0,t2.loadTerrain)(R))},M[0]=R,M[1]=w):w=M[1],k=(0,t0.useQuery)(w),M[2]!==k.data||M[3]!==k.error||M[4]!==k.status||M[5]!==R?(C=()=>{ro.debug("Query status: %s%s%s file=%s",k.status,k.error?` error=${k.error.message}`:"",k.data?" (data ready)":" (no data)",R)},j=[k.status,k.error,k.data,R],M[2]=k.data,M[3]=k.error,M[4]=k.status,M[5]=R,M[6]=C,M[7]=j):(C=M[6],j=M[7]),(0,a.useEffect)(C,j),k);e:{let e;if(!z){i=null;break e}let t=256*D;T[4]!==t||T[5]!==D||T[6]!==z.heightMap?(!function(e,t,r){let n=e.attributes.position,a=e.attributes.uv,o=e.attributes.normal,i=n.array,l=a.array,s=o.array,c=n.count,u=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),a=Math.floor(r=Math.max(0,Math.min(255,r))),o=Math.min(n+1,255),i=Math.min(a+1,255),l=e-n,s=r-a;return(t[256*a+n]/65535*2048*(1-l)+t[256*a+o]/65535*2048*l)*(1-s)+(t[256*i+n]/65535*2048*(1-l)+t[256*i+o]/65535*2048*l)*s};for(let e=0;e<c;e++){let t=l[2*e],n=l[2*e+1],a=u(255&Math.floor(256*t),255&Math.floor(256*n));i[3*e+1]=a;let o=255*t,c=255*n,m=d(o-1,c),f=d(o+1,c),h=(d(o,c+1)-d(o,c-1))/2,p=r,g=(f-m)/2,v=Math.sqrt(h*h+p*p+g*g);v>0?(h/=v,p/=v,g/=v):(h=0,p=1,g=0),s[3*e]=h,s[3*e+1]=p,s[3*e+2]=g}n.needsUpdate=!0,o.needsUpdate=!0}(e=function(e,t){let r=new tC.BufferGeometry,n=new Float32Array(198147),a=new Float32Array(198147),o=new Float32Array(132098),i=new Uint32Array(393216),l=0,s=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let i=257*t+r;n[3*i]=r*s-e/2,n[3*i+1]=e/2-t*s,n[3*i+2]=0,a[3*i]=0,a[3*i+1]=0,a[3*i+2]=1,o[2*i]=r/256,o[2*i+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,a=(e+1)*257+t,o=a+1;((t^e)&1)==0?(i[l++]=r,i[l++]=a,i[l++]=o,i[l++]=r,i[l++]=o,i[l++]=n):(i[l++]=r,i[l++]=a,i[l++]=n,i[l++]=n,i[l++]=a,i[l++]=o)}return r.setIndex(new tC.BufferAttribute(i,1)),r.setAttribute("position",new tC.Float32BufferAttribute(n,3)),r.setAttribute("normal",new tC.Float32BufferAttribute(a,3)),r.setAttribute("uv",new tC.Float32BufferAttribute(o,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),z.heightMap,D),T[4]=t,T[5]=D,T[6]=z.heightMap,T[7]=e):e=T[7],i=e}let U=i;T[8]!==D||T[9]!==z?(l=()=>{if(z){var e;return ra((e=z.heightMap,(t,r)=>{let n=Math.max(0,Math.min(255,t/D+128)),a=Math.max(0,Math.min(255,r/D+128)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]*(1-c)+e[256*i+l]*c)*(1-u)+(e[256*s+o]*(1-c)+e[256*s+l]*c)*u)/65535*2048})),rc}},s=[z,D],T[8]=D,T[9]=z,T[10]=l,T[11]=s):(l=T[10],s=T[11]),(0,a.useEffect)(l,s);let G=(0,eX.useSceneSun)();t:{let e,t;if(!G){let e;T[12]===Symbol.for("react.memo_cache_sentinel")?(e=new tC.Vector3(.57735,-.57735,.57735),T[12]=e):e=T[12],c=e;break t}T[13]!==G.direction?(e=(0,t1.torqueToThree)(G.direction),T[13]=G.direction,T[14]=e):e=T[14];let[r,n,a]=e,o=Math.sqrt(r*r+n*n+a*a),i=r/o,l=n/o,s=a/o;T[15]!==s||T[16]!==i||T[17]!==l?(t=new tC.Vector3(i,l,s),T[15]=s,T[16]=i,T[17]=l,T[18]=t):t=T[18],c=t}let W=c;r:{let e;if(!z){u=null;break r}T[19]!==D||T[20]!==W||T[21]!==z.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),a=Math.max(0,Math.min(255,r)),o=Math.floor(n),i=Math.floor(a),l=Math.min(o+1,255),s=Math.min(i+1,255),c=n-o,u=a-i;return((e[256*i+o]/65535*(1-c)+e[256*i+l]/65535*c)*(1-u)+(e[256*s+o]/65535*(1-c)+e[256*s+l]/65535*c)*u)*2048},a=new tC.Vector3(-t.x,-t.y,-t.z).normalize(),o=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=t/2+.25,l=e/2+.25,s=n(i,l),c=n(i-.5,l),u=n(i+.5,l),d=n(i,l-.5),m=-((n(i,l+.5)-d)/1),f=-((u-c)/1),h=Math.sqrt(m*m+r*r+f*f),p=Math.max(0,m/h*a.x+r/h*a.y+f/h*a.z),g=1;p>0&&(g=function(e,t,r,n,a,o){let i=n.z/a,l=n.x/a,s=n.y,c=Math.sqrt(i*i+l*l);if(c<1e-4)return 1;let u=.5/c,d=i*u,m=l*u,f=s*u,h=e,p=t,g=r+.1;for(let e=0;e<768&&(h+=d,p+=m,g+=f,!(h<0)&&!(h>=256)&&!(p<0)&&!(p>=256)&&!(g>2048));e++)if(g<o(h,p))return 0;return 1}(i,l,s,a,r,n)),o[512*e+t]=Math.floor(p*g*255)}let i=new tC.DataTexture(o,512,512,tC.RedFormat,tC.UnsignedByteType);return i.colorSpace=tC.NoColorSpace,i.generateMipmaps=!0,i.wrapS=tC.ClampToEdgeWrapping,i.wrapT=tC.ClampToEdgeWrapping,i.magFilter=tC.LinearFilter,i.minFilter=tC.LinearFilter,i.needsUpdate=!0,i}(z.heightMap,W,D),T[19]=D,T[20]=W,T[21]=z.heightMap,T[22]=e):e=T[22],u=e}let H=u;n:{let e;if(!z){d=null;break n}if(T[23]!==z.heightMap){let t=function(e){let t=new Float32Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(z.heightMap);(e=new tC.DataTexture(t,256,256,tC.RedFormat,tC.FloatType)).colorSpace=tC.NoColorSpace,e.generateMipmaps=!1,e.wrapS=tC.RepeatWrapping,e.wrapT=tC.RepeatWrapping,e.needsUpdate=!0,T[23]=z.heightMap,T[24]=e}else e=T[24];d=e}let O=d;T[25]!==A?(m=ri(A),T[25]=A,T[26]=m):m=T[26];let V=m;T[27]===Symbol.for("react.memo_cache_sentinel")?(f=ri([]),T[27]=f):f=T[27];let q=f;a:{let e;if(!z){h=null;break a}T[28]!==z.alphaMaps?(e=z.alphaMaps.map(ru),T[28]=z.alphaMaps,T[29]=e):e=T[29],h=e}let $=h,K=2*Math.ceil(I/F)+1,Q=K*K-1;T[30]!==Q?(p=Array.from({length:Q},rd),T[30]=Q,T[31]=p):p=T[31];let Y=p;T[32]!==Q?(g=()=>Array(Q).fill(null),T[32]=Q,T[33]=g):g=T[33];let[X,Z]=(0,a.useState)(g);T[34]===Symbol.for("react.memo_cache_sentinel")?(v={xStart:0,xEnd:0,zStart:0,zEnd:0},T[34]=v):v=T[34];let J=(0,a.useRef)(v);return(T[35]!==P.x||T[36]!==P.z||T[37]!==F||T[38]!==E.position.x||T[39]!==E.position.z||T[40]!==Q||T[41]!==I?(x=()=>{let e=E.position.x-P.x,t=E.position.z-P.z,r=Math.floor((e-I)/F),n=Math.ceil((e+I)/F),a=Math.floor((t-I)/F),o=Math.ceil((t+I)/F),i=J.current;if(r===i.xStart&&n===i.xEnd&&a===i.zStart&&o===i.zEnd)return;i.xStart=r,i.xEnd=n,i.zStart=a,i.zEnd=o;let l=[];for(let e=r;e<n;e++)for(let t=a;t<o;t++)(0!==e||0!==t)&&l.push({tileX:e,tileZ:t});for(;l.length<Q;)l.push(null);Z(l)},T[35]=P.x,T[36]=P.z,T[37]=F,T[38]=E.position.x,T[39]=E.position.z,T[40]=Q,T[41]=I,T[42]=x):x=T[42],(0,tw.useFrame)(x),z&&U&&O&&$)?(T[43]!==P||T[44]!==F||T[45]!==L||T[46]!==V||T[47]!==$||T[48]!==O||T[49]!==U||T[50]!==z.textureNames||T[51]!==H?(y=(0,r.jsx)(rn,{tileX:0,tileZ:0,blockSize:F,basePosition:P,textureNames:z.textureNames,geometry:U,displacementMap:O,visibilityMask:V,alphaTextures:$,detailTextureName:L,lightmap:H}),T[43]=P,T[44]=F,T[45]=L,T[46]=V,T[47]=$,T[48]=O,T[49]=U,T[50]=z.textureNames,T[51]=H,T[52]=y):y=T[52],T[53]!==P||T[54]!==F||T[55]!==L||T[56]!==Y||T[57]!==$||T[58]!==O||T[59]!==U||T[60]!==z.textureNames||T[61]!==H||T[62]!==X?(b=Y.map(e=>{let t=X[e];return(0,r.jsx)(rn,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:F,basePosition:P,textureNames:z.textureNames,geometry:U,displacementMap:O,visibilityMask:q,alphaTextures:$,detailTextureName:L,lightmap:H,visible:null!==t},e)}),T[53]=P,T[54]=F,T[55]=L,T[56]=Y,T[57]=$,T[58]=O,T[59]=U,T[60]=z.textureNames,T[61]=H,T[62]=X,T[63]=b):b=T[63],T[64]!==y||T[65]!==b?(_=(0,r.jsxs)(r.Fragment,{children:[y,b]}),T[64]=y,T[65]=b,T[66]=_):_=T[66],_):(ro.debug("Not ready: terrain=%s geometry=%s displacement=%s alpha=%s",!!z,!!U,!!O,!!$),null)});function rs(e){return e.camera}function rc(){return ra(null)}function ru(e){return(0,t3.setupMask)(e)}function rd(e,t){return t}var rm=e.i(8597),rf=e.i(78140);let rh=`
|
||
vec3 interiorLinearToSRGB(vec3 linear) {
|
||
vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055;
|
||
vec3 lower = linear * 12.92;
|
||
return mix(lower, higher, step(vec3(0.0031308), linear));
|
||
}
|
||
|
||
vec3 interiorSRGBToLinear(vec3 srgb) {
|
||
vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4));
|
||
vec3 lower = srgb / 12.92;
|
||
return mix(lower, higher, step(vec3(0.04045), srgb));
|
||
}
|
||
|
||
// Debug grid overlay function using screen-space derivatives for sharp, anti-aliased lines
|
||
// Returns 1.0 on grid lines, 0.0 elsewhere
|
||
float debugGrid(vec2 uv, float gridSize, float lineWidth) {
|
||
vec2 scaledUV = uv * gridSize;
|
||
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
|
||
float line = min(grid.x, grid.y);
|
||
return 1.0 - min(line / lineWidth, 1.0);
|
||
}
|
||
`,rp=(0,M.createLogger)("InteriorInstance");function rg({materialName:e,material:t,lightMap:n}){let o=(0,_.useDebug)(),i=o?.debugMode??!1,l=(0,t8.useAnisotropy)(),s=(0,t2.textureToUrl)(e),c=(0,t5.useTexture)(s,e=>(0,t3.setupTexture)(e,{anisotropy:l})),u=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),d=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),m=(0,a.useCallback)(e=>{let t;(0,t7.injectCustomFog)(e,t9.globalFogUniforms),t=d??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new tC.Vector3(0,.4,1):new tC.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include <common>",`#include <common>
|
||
${rh}
|
||
uniform bool useSceneLighting;
|
||
uniform vec3 interiorDebugColor;
|
||
`),e.fragmentShader=e.fragmentShader.replace("#include <lights_fragment_maps>",`// Lightmap handled in custom output calculation
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
||
#endif`),e.fragmentShader=e.fragmentShader.replace("#include <opaque_fragment>",`// 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 <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`// 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 <tonemapping_fragment>`)},[d]),f=(0,a.useRef)(null),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=f.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let p={DEBUG_MODE:+!!i},g=`${d}`;return u?(0,r.jsx)("meshBasicMaterial",{ref:f,map:c,toneMapped:!1,defines:p,onBeforeCompile:m},g):(0,r.jsx)("meshLambertMaterial",{ref:h,map:c,lightMap:n,toneMapped:!1,defines:p,onBeforeCompile:m},g)}function rv(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=tC.SRGBColorSpace),t??null}function rx(e){let t,a,o,i=(0,n.c)(13),{node:l}=e;e:{let e,r;if(!l.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],t=e;break e}if(Array.isArray(l.material)){let e;i[1]!==l.material?(e=l.material.map(ry),i[1]=l.material,i[2]=e):e=i[2],t=e;break e}i[3]!==l.material?(e=rv(l.material),i[3]=l.material,i[4]=e):e=i[4],i[5]!==e?(r=[e],i[5]=e,i[6]=r):r=i[6],t=r}let s=t;return i[7]!==s||i[8]!==l.material?(a=l.material?(0,r.jsx)(tQ.DebugSuspense,{name:`InteriorTexture:${Array.isArray(l.material)?l.material[0]?.userData?.resource_path:l.material?.userData?.resource_path??"?"}`,fallback:(0,r.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(l.material)?l.material.map((e,t)=>(0,r.jsx)(rg,{materialName:e.userData.resource_path,material:e,lightMap:s[t]},t)):(0,r.jsx)(rg,{materialName:l.material.userData.resource_path,material:l.material,lightMap:s[0]})}):null,i[7]=s,i[8]=l.material,i[9]=a):a=i[9],i[10]!==l.geometry||i[11]!==a?(o=(0,r.jsx)("mesh",{geometry:l.geometry,castShadow:!0,receiveShadow:!0,children:a}),i[10]=l.geometry,i[11]=a,i[12]=o):o=i[12],o}function ry(e){return rv(e)}let rb=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u=(0,n.c)(10),{interiorFile:d,ghostIndex:m}=e,{nodes:f}=((s=(0,n.c)(2))[0]!==d?(l=(0,t2.interiorToUrl)(d),s[0]=d,s[1]=l):l=s[1],c=l,(0,rf.useGLTF)(c)),h=(0,_.useDebug)(),p=h?.debugMode??!1;return u[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],u[0]=t):t=u[0],u[1]!==f?(a=Object.entries(f).filter(rC).map(rj),u[1]=f,u[2]=a):a=u[2],u[3]!==p||u[4]!==m||u[5]!==d?(o=p?(0,r.jsxs)(tX.FloatingLabel,{children:[m,": ",d]}):null,u[3]=p,u[4]=m,u[5]=d,u[6]=o):o=u[6],u[7]!==a||u[8]!==o?(i=(0,r.jsxs)("group",{rotation:t,children:[a,o]}),u[7]=a,u[8]=o,u[9]=i):i=u[9],i});function r_(e){let t,a,o,i,l=(0,n.c)(9),{color:s,label:c}=e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("boxGeometry",{args:[10,10,10]}),l[0]=t):t=l[0],l[1]!==s?(a=(0,r.jsx)("meshStandardMaterial",{color:s,wireframe:!0}),l[1]=s,l[2]=a):a=l[2],l[3]!==s||l[4]!==c?(o=c?(0,r.jsx)(tX.FloatingLabel,{color:s,children:c}):null,l[3]=s,l[4]=c,l[5]=o):o=l[5],l[6]!==a||l[7]!==o?(i=(0,r.jsxs)("mesh",{children:[t,a,o]}),l[6]=a,l[7]=o,l[8]=i):i=l[8],i}function rS(e){let t,a=(0,n.c)(3),{label:o}=e,i=(0,_.useDebug)(),l=i?.debugMode??!1;return a[0]!==l||a[1]!==o?(t=l?(0,r.jsx)(r_,{color:"red",label:o}):null,a[0]=l,a[1]=o,a[2]=t):t=a[2],t}let rw=(0,a.memo)(function(e){let t,a,o,i,l,s,c,u,d,m,f=(0,n.c)(26),{scene:h}=e;f[0]!==h.transform.position?(t=(0,t1.torqueToThree)(h.transform.position),f[0]=h.transform.position,f[1]=t):t=f[1];let p=t;f[2]!==h.transform?(a=(0,t1.matrixFToQuaternion)(h.transform),f[2]=h.transform,f[3]=a):a=f[3];let g=a;f[4]!==h.scale?(o=(0,t1.torqueScaleToThree)(h.scale),f[4]=h.scale,f[5]=o):o=f[5];let v=o,x=`${h.ghostIndex}: ${h.interiorFile}`;f[6]!==x?(i=(0,r.jsx)(rS,{label:x}),f[6]=x,f[7]=i):i=f[7],f[8]!==h.interiorFile?(l=e=>{rp.error("Failed to load %s: %s",h.interiorFile,e.message)},f[8]=h.interiorFile,f[9]=l):l=f[9];let y=`InteriorModel:${h.interiorFile}`;return f[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(r_,{color:"orange"}),f[10]=s):s=f[10],f[11]!==h.ghostIndex||f[12]!==h.interiorFile?(c=(0,r.jsx)(rb,{interiorFile:h.interiorFile,ghostIndex:h.ghostIndex}),f[11]=h.ghostIndex,f[12]=h.interiorFile,f[13]=c):c=f[13],f[14]!==y||f[15]!==c?(u=(0,r.jsx)(tQ.DebugSuspense,{name:y,fallback:s,children:c}),f[14]=y,f[15]=c,f[16]=u):u=f[16],f[17]!==u||f[18]!==i||f[19]!==l?(d=(0,r.jsx)(rm.ErrorBoundary,{fallback:i,onError:l,children:u}),f[17]=u,f[18]=i,f[19]=l,f[20]=d):d=f[20],f[21]!==p||f[22]!==g||f[23]!==v||f[24]!==d?(m=(0,r.jsx)("group",{position:p,quaternion:g,scale:v,children:d}),f[21]=p,f[22]=g,f[23]=v,f[24]=d,f[25]=m):m=f[25],m});function rC(e){let[,t]=e;return t.isMesh}function rj(e){let[t,n]=e;return(0,r.jsx)(rx,{node:n},t)}var rM=e.i(99143);function rk(e,{path:t}){let[r]=(0,rM.useLoader)(tC.CubeTextureLoader,[e],e=>e.setPath(t));return r}rk.preload=(e,{path:t})=>rM.useLoader.preload(tC.CubeTextureLoader,[e],e=>e.setPath(t));let rT=()=>{};function rN(e){return e.wrapS=tC.RepeatWrapping,e.wrapT=tC.RepeatWrapping,e.minFilter=tC.LinearFilter,e.magFilter=tC.LinearFilter,e.colorSpace=tC.NoColorSpace,e.needsUpdate=!0,e}let rR=`
|
||
attribute float alpha;
|
||
|
||
uniform vec2 uvOffset;
|
||
|
||
varying vec2 vUv;
|
||
varying float vAlpha;
|
||
|
||
void main() {
|
||
// Apply UV offset for scrolling
|
||
vUv = uv + uvOffset;
|
||
vAlpha = alpha;
|
||
|
||
vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||
// Set depth to far plane so clouds are always visible and behind other geometry
|
||
gl_Position = pos.xyww;
|
||
}
|
||
`,rD=`
|
||
uniform sampler2D cloudTexture;
|
||
uniform float debugMode;
|
||
uniform int layerIndex;
|
||
|
||
varying vec2 vUv;
|
||
varying float vAlpha;
|
||
|
||
// Debug grid using screen-space derivatives for sharp, anti-aliased lines
|
||
float debugGrid(vec2 uv, float gridSize, float lineWidth) {
|
||
vec2 scaledUV = uv * gridSize;
|
||
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
|
||
float line = min(grid.x, grid.y);
|
||
return 1.0 - min(line / lineWidth, 1.0);
|
||
}
|
||
|
||
void main() {
|
||
vec4 texColor = texture2D(cloudTexture, vUv);
|
||
|
||
// Tribes 2 uses GL_MODULATE: final = texture \xd7 vertex color
|
||
// Vertex color is white with varying alpha, so:
|
||
// Final RGB = Texture RGB \xd7 1.0 = Texture RGB
|
||
// Final Alpha = Texture Alpha \xd7 Vertex Alpha
|
||
float finalAlpha = texColor.a * vAlpha;
|
||
vec3 color = texColor.rgb;
|
||
|
||
// Debug mode: overlay R/G/B grid for layers 0/1/2
|
||
if (debugMode > 0.5) {
|
||
float gridIntensity = debugGrid(vUv, 4.0, 1.5);
|
||
vec3 gridColor;
|
||
if (layerIndex == 0) {
|
||
gridColor = vec3(1.0, 0.0, 0.0); // Red
|
||
} else if (layerIndex == 1) {
|
||
gridColor = vec3(0.0, 1.0, 0.0); // Green
|
||
} else {
|
||
gridColor = vec3(0.0, 0.0, 1.0); // Blue
|
||
}
|
||
color = mix(color, gridColor, gridIntensity * 0.5);
|
||
}
|
||
|
||
// Output clouds with texture color and combined alpha
|
||
gl_FragColor = vec4(color, finalAlpha);
|
||
}
|
||
`;function rL({textureUrl:e,radius:t,heightPercent:n,speed:o,windDirection:i,layerIndex:l}){let{debugMode:s}=(0,_.useDebug)(),{animationEnabled:c}=(0,_.useSettings)(),u=(0,a.useRef)(null),d=(0,t5.useTexture)(e,rN),m=(0,a.useMemo)(()=>{let e=n-.05;return function(e,t,r,n){var a;let o,i,l,s,c,u,d,m,f,h,p,g,v,x,y,b,_,S=new tC.BufferGeometry,w=new Float32Array(75),C=new Float32Array(50),j=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],M=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,a=-e+r*M,o=e-t*M,i=e*j[n];w[3*n]=a,w[3*n+1]=i,w[3*n+2]=o,C[2*n]=r,C[2*n+1]=t}a=w,o=e=>({x:a[3*e],y:a[3*e+1],z:a[3*e+2]}),i=(e,t,r,n)=>{a[3*e]=t,a[3*e+1]=r,a[3*e+2]=n},l=o(1),s=o(3),c=o(5),u=o(6),d=o(8),m=o(9),f=o(15),h=o(16),p=o(18),g=o(19),v=o(21),x=o(23),y=c.x+(l.x-c.x)*.5,b=c.y+(l.y-c.y)*.5,_=c.z+(l.z-c.z)*.5,i(0,u.x+(y-u.x)*2,u.y+(b-u.y)*2,u.z+(_-u.z)*2),y=m.x+(s.x-m.x)*.5,b=m.y+(s.y-m.y)*.5,_=m.z+(s.z-m.z)*.5,i(4,d.x+(y-d.x)*2,d.y+(b-d.y)*2,d.z+(_-d.z)*2),y=v.x+(f.x-v.x)*.5,b=v.y+(f.y-v.y)*.5,_=v.z+(f.z-v.z)*.5,i(20,h.x+(y-h.x)*2,h.y+(b-h.y)*2,h.z+(_-h.z)*2),y=x.x+(g.x-x.x)*.5,b=x.y+(g.y-x.y)*.5,_=x.z+(g.z-x.z)*.5,i(24,p.x+(y-p.x)*2,p.y+(b-p.y)*2,p.z+(_-p.z)*2);let k=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let a=e[3*n],o=e[3*n+2],i=1.3-Math.sqrt(a*a+o*o)/t;i<.4?i=0:i>.8&&(i=1),r[n]=i}return r}(w,e),T=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,a=r+5,o=a+1;T.push(r,a,o),T.push(r,o,n)}return S.setIndex(T),S.setAttribute("position",new tC.Float32BufferAttribute(w,3)),S.setAttribute("uv",new tC.Float32BufferAttribute(C,2)),S.setAttribute("alpha",new tC.Float32BufferAttribute(k,1)),S.computeBoundingSphere(),S}(t,n,e,0)},[t,n]);(0,a.useEffect)(()=>()=>{m.dispose()},[m]);let f=(0,a.useMemo)(()=>new tC.ShaderMaterial({uniforms:{cloudTexture:{value:d},uvOffset:{value:new tC.Vector2(0,0)},debugMode:{value:+!!s},layerIndex:{value:l}},vertexShader:rR,fragmentShader:rD,transparent:!0,depthWrite:!1,side:tC.DoubleSide}),[d,s,l]);return(0,a.useEffect)(()=>()=>{f.dispose()},[f]),(0,tw.useFrame)(c?(e,t)=>{let r=1e3*t/32;u.current??=new tC.Vector2(0,0),u.current.x+=i.x*o*r,u.current.y+=i.y*o*r,u.current.x-=Math.floor(u.current.x),u.current.y-=Math.floor(u.current.y),f.uniforms.uvOffset.value.copy(u.current)}:rT),(0,r.jsx)("mesh",{geometry:m,frustumCulled:!1,renderOrder:10,children:(0,r.jsx)("primitive",{object:f,attach:"material"})})}function rF(e){var t;let o,i,l,s,c,u,d,m,f,h,p,g=(0,n.c)(18),{scene:v}=e,{data:x}=(t=v.materialList||void 0,(h=(0,n.c)(7))[0]!==t?(d=["detailMapList",t],m=()=>(0,t2.loadDetailMapList)(t),h[0]=t,h[1]=d,h[2]=m):(d=h[1],m=h[2]),p=!!t,h[3]!==d||h[4]!==m||h[5]!==p?(f={queryKey:d,queryFn:m,enabled:p},h[3]=d,h[4]=m,h[5]=p,h[6]=f):f=h[6],(0,t0.useQuery)(f)),y=.95*(v.visibleDistance>0?v.visibleDistance:500);g[0]!==v.cloudLayers?(o=v.cloudLayers.map(rE),g[0]=v.cloudLayers,g[1]=o):o=g[1];let b=o;g[2]!==v.cloudLayers?(i=v.cloudLayers.map(rI),g[2]=v.cloudLayers,g[3]=i):i=g[3];let _=i;e:{let e,{x:t,y:r}=v.windVelocity;if(0!==t||0!==r){let e;g[4]!==t||g[5]!==r?(e=new tC.Vector2(r,-t).normalize(),g[4]=t,g[5]=r,g[6]=e):e=g[6],l=e;break e}g[7]===Symbol.for("react.memo_cache_sentinel")?(e=new tC.Vector2(1,0),g[7]=e):e=g[7],l=e}let S=l;t:{let e;if(!x){let e;g[8]===Symbol.for("react.memo_cache_sentinel")?(e=[],g[8]=e):e=g[8],s=e;break t}if(g[9]!==_||g[10]!==b||g[11]!==x){e=[];for(let t=0;t<3;t++){let r=x[7+t];r&&e.push({texture:r,height:_[t],speed:b[t]})}g[9]=_,g[10]=b,g[11]=x,g[12]=e}else e=g[12];s=e}let w=s,C=(0,a.useRef)(null);return(g[13]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{let{camera:t}=e;C.current&&C.current.position.copy(t.position)},g[13]=c):c=g[13],(0,tw.useFrame)(c),w&&0!==w.length)?(g[14]!==w||g[15]!==y||g[16]!==S?(u=(0,r.jsx)("group",{ref:C,children:w.map((e,t)=>{let n=(0,t2.textureToUrl)(e.texture);return(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rL,{textureUrl:n,radius:y,heightPercent:e.height,speed:e.speed,windDirection:S,layerIndex:t})},t)})}),g[14]=w,g[15]=y,g[16]=S,g[17]=u):u=g[17],u):null}function rI(e,t){return e.heightPercent||[.35,.25,.2][t]}function rE(e,t){return e.speed||[1e-4,2e-4,3e-4][t]}e.i(62395);let rB=(0,M.createLogger)("Sky"),rP=!1;function rA(e){return[new tC.Color().setRGB(e.r,e.g,e.b),new tC.Color().setRGB(e.r,e.g,e.b).convertSRGBToLinear()]}function rz({skyBoxFiles:e,fogColor:t,fogState:n}){let o=(0,tS.useThree)(e=>e.camera),i=rk(e,{path:""}),l=!!t,s=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),c=(0,a.useMemo)(()=>n?(0,t9.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),u=(0,a.useRef)({skybox:{value:i},fogColor:{value:t??new tC.Color(0,0,0)},enableFog:{value:l},inverseProjectionMatrix:{value:s},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:t9.globalFogUniforms.cameraHeight,fogVolumeData:{value:c},horizonFogHeight:{value:.18}}),d=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]);return(0,a.useEffect)(()=>{u.current.skybox.value=i,u.current.fogColor.value=t??new tC.Color(0,0,0),u.current.enableFog.value=l,u.current.fogVolumeData.value=c,u.current.horizonFogHeight.value=d},[i,t,l,c,d]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = vec4(position.xy, 0.9999, 1.0);
|
||
}
|
||
`,fragmentShader:`
|
||
uniform samplerCube skybox;
|
||
uniform vec3 fogColor;
|
||
uniform bool enableFog;
|
||
uniform mat4 inverseProjectionMatrix;
|
||
uniform mat4 cameraMatrixWorld;
|
||
uniform float cameraHeight;
|
||
uniform float fogVolumeData[12];
|
||
uniform float horizonFogHeight;
|
||
|
||
varying vec2 vUv;
|
||
|
||
// Convert linear to sRGB for display
|
||
// shaderMaterial does NOT get automatic linear->sRGB output conversion
|
||
// Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js
|
||
vec3 linearToSRGB(vec3 linear) {
|
||
vec3 low = linear * 12.92;
|
||
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
|
||
return mix(low, high, step(vec3(0.0031308), linear));
|
||
}
|
||
|
||
void main() {
|
||
vec2 ndc = vUv * 2.0 - 1.0;
|
||
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
|
||
viewPos.xyz /= viewPos.w;
|
||
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
|
||
direction = vec3(direction.z, direction.y, -direction.x);
|
||
// Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear
|
||
vec4 skyColor = textureCube(skybox, direction);
|
||
vec3 finalColor;
|
||
|
||
if (enableFog) {
|
||
vec3 effectiveFogColor = fogColor;
|
||
|
||
// Calculate how much fog volume the ray passes through
|
||
// For skybox at "infinite" distance, the relevant height is how much
|
||
// of the volume is above/below camera depending on view direction
|
||
float volumeFogInfluence = 0.0;
|
||
|
||
for (int i = 0; i < 3; i++) {
|
||
int offset = i * 4;
|
||
float volVisDist = fogVolumeData[offset + 0];
|
||
float volMinH = fogVolumeData[offset + 1];
|
||
float volMaxH = fogVolumeData[offset + 2];
|
||
float volPct = fogVolumeData[offset + 3];
|
||
|
||
if (volVisDist <= 0.0) continue;
|
||
|
||
// Check if camera is inside this volume
|
||
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
|
||
// Camera is inside the fog volume
|
||
// Looking horizontally or up at shallow angles means ray travels
|
||
// through more fog before exiting the volume
|
||
float heightAboveCamera = volMaxH - cameraHeight;
|
||
float heightBelowCamera = cameraHeight - volMinH;
|
||
float volumeHeight = volMaxH - volMinH;
|
||
|
||
// For horizontal rays (direction.y ≈ 0), maximum fog influence
|
||
// For rays going up steeply, less fog (exits volume quickly)
|
||
// For rays going down, more fog (travels through volume below)
|
||
float rayInfluence;
|
||
if (direction.y >= 0.0) {
|
||
// Looking up: influence based on how steep we're looking
|
||
// Shallow angles = long path through fog = high influence
|
||
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
|
||
} else {
|
||
// Looking down: always high fog (into the volume)
|
||
rayInfluence = 1.0;
|
||
}
|
||
|
||
// Scale by percentage and volume depth factor
|
||
volumeFogInfluence += rayInfluence * volPct;
|
||
}
|
||
}
|
||
|
||
// Base fog factor from view direction (for haze at horizon)
|
||
// In Torque, the fog "bans" (bands) are rendered as geometry from
|
||
// height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox.
|
||
// The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3).
|
||
//
|
||
// horizonFogHeight is the direction.y value where the fog band ends:
|
||
// horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2)
|
||
//
|
||
// For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18
|
||
//
|
||
// Torque renders the fog bands as geometry with linear vertex alpha
|
||
// interpolation. We use a squared curve (t^2) to create a gentler
|
||
// falloff at the top of the gradient, matching Tribes 2's appearance.
|
||
float baseFogFactor;
|
||
if (direction.y <= 0.0) {
|
||
// Looking at or below horizon: full fog
|
||
baseFogFactor = 1.0;
|
||
} else if (direction.y >= horizonFogHeight) {
|
||
// Above fog band: no fog
|
||
baseFogFactor = 0.0;
|
||
} else {
|
||
// Within fog band: squared curve for gentler falloff at top
|
||
float t = direction.y / horizonFogHeight;
|
||
baseFogFactor = (1.0 - t) * (1.0 - t);
|
||
}
|
||
|
||
// Combine base fog with volume fog influence
|
||
// When inside a volume, increase fog intensity
|
||
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
|
||
|
||
finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor);
|
||
} else {
|
||
finalColor = skyColor.rgb;
|
||
}
|
||
// Convert linear result to sRGB for display
|
||
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
|
||
}
|
||
`,depthWrite:!1,depthTest:!1})]})}function rU(e){let t,o,i,l,s,c,u,d=(0,n.c)(6),{materialList:m,fogColor:f,fogState:h}=e,{data:p}=((c=(0,n.c)(8))[0]!==m?(i={queryKey:["detailMapList",m],queryFn:()=>(rB.debug("Loading detail map list: %s",m),(0,t2.loadDetailMapList)(m))},c[0]=m,c[1]=i):i=c[1],u=(0,t0.useQuery)(i),c[2]!==m||c[3]!==u.data||c[4]!==u.error||c[5]!==u.status?(l=()=>{rB.debug("DML query status: %s%s%s file=%s",u.status,u.error?` error=${u.error.message}`:"",u.data?` (${u.data.length} entries)`:" (no data)",m)},s=[u.status,u.error,u.data,m],c[2]=m,c[3]=u.data,c[4]=u.error,c[5]=u.status,c[6]=l,c[7]=s):(l=c[6],s=c[7]),(0,a.useEffect)(l,s),u);d[0]!==p?(t=p?[(0,t2.textureToUrl)(p[1]),(0,t2.textureToUrl)(p[3]),(0,t2.textureToUrl)(p[4]),(0,t2.textureToUrl)(p[5]),(0,t2.textureToUrl)(p[0]),(0,t2.textureToUrl)(p[2])]:null,d[0]=p,d[1]=t):t=d[1];let g=t;return g?(d[2]!==f||d[3]!==h||d[4]!==g?(o=(0,r.jsx)(rz,{skyBoxFiles:g,fogColor:f,fogState:h}),d[2]=f,d[3]=h,d[4]=g,d[5]=o):o=d[5],o):null}function rG({skyColor:e,fogColor:t,fogState:n}){let o=(0,tS.useThree)(e=>e.camera),i=!!t,l=(0,a.useMemo)(()=>o.projectionMatrixInverse,[o]),s=(0,a.useMemo)(()=>n?(0,t9.packFogVolumeData)(n.fogVolumes):new Float32Array(12),[n]),c=(0,a.useMemo)(()=>{if(!n)return .18;let e=.95*n.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[n]),u=(0,a.useRef)({skyColor:{value:e},fogColor:{value:t??new tC.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:l},cameraMatrixWorld:{value:o.matrixWorld},cameraHeight:t9.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:c}});return(0,a.useEffect)(()=>{u.current.skyColor.value=e,u.current.fogColor.value=t??new tC.Color(0,0,0),u.current.enableFog.value=i,u.current.fogVolumeData.value=s,u.current.horizonFogHeight.value=c},[e,t,i,s,c]),(0,r.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,r.jsx)("shaderMaterial",{uniforms:u.current,vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = vec4(position.xy, 0.9999, 1.0);
|
||
}
|
||
`,fragmentShader:`
|
||
uniform vec3 skyColor;
|
||
uniform vec3 fogColor;
|
||
uniform bool enableFog;
|
||
uniform mat4 inverseProjectionMatrix;
|
||
uniform mat4 cameraMatrixWorld;
|
||
uniform float cameraHeight;
|
||
uniform float fogVolumeData[12];
|
||
uniform float horizonFogHeight;
|
||
|
||
varying vec2 vUv;
|
||
|
||
// Convert linear to sRGB for display
|
||
vec3 linearToSRGB(vec3 linear) {
|
||
vec3 low = linear * 12.92;
|
||
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
|
||
return mix(low, high, step(vec3(0.0031308), linear));
|
||
}
|
||
|
||
void main() {
|
||
vec2 ndc = vUv * 2.0 - 1.0;
|
||
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
|
||
viewPos.xyz /= viewPos.w;
|
||
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
|
||
direction = vec3(direction.z, direction.y, -direction.x);
|
||
|
||
vec3 finalColor;
|
||
|
||
if (enableFog) {
|
||
// Calculate volume fog influence (same logic as SkyBoxTexture)
|
||
float volumeFogInfluence = 0.0;
|
||
|
||
for (int i = 0; i < 3; i++) {
|
||
int offset = i * 4;
|
||
float volVisDist = fogVolumeData[offset + 0];
|
||
float volMinH = fogVolumeData[offset + 1];
|
||
float volMaxH = fogVolumeData[offset + 2];
|
||
float volPct = fogVolumeData[offset + 3];
|
||
|
||
if (volVisDist <= 0.0) continue;
|
||
|
||
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
|
||
float rayInfluence;
|
||
if (direction.y >= 0.0) {
|
||
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
|
||
} else {
|
||
rayInfluence = 1.0;
|
||
}
|
||
volumeFogInfluence += rayInfluence * volPct;
|
||
}
|
||
}
|
||
|
||
// Base fog factor from view direction
|
||
float baseFogFactor;
|
||
if (direction.y <= 0.0) {
|
||
baseFogFactor = 1.0;
|
||
} else if (direction.y >= horizonFogHeight) {
|
||
baseFogFactor = 0.0;
|
||
} else {
|
||
float t = direction.y / horizonFogHeight;
|
||
baseFogFactor = (1.0 - t) * (1.0 - t);
|
||
}
|
||
|
||
// Combine base fog with volume fog influence
|
||
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
|
||
|
||
finalColor = mix(skyColor, fogColor, finalFogFactor);
|
||
} else {
|
||
finalColor = skyColor;
|
||
}
|
||
|
||
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
|
||
}
|
||
`,depthWrite:!1,depthTest:!1})]})}function rW(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function rH({fogState:e,enabled:t}){let r=(0,tS.useThree)(e=>e.scene),n=(0,tS.useThree)(e=>e.camera),o=(0,a.useRef)(null),i=(0,a.useMemo)(()=>(0,t9.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,a.useEffect)(()=>{rP||((0,t7.installCustomFogShader)(),rP=!0)},[]),(0,a.useEffect)(()=>{(0,t9.resetGlobalFogUniforms)();let[t,a]=rW(e,n.position.y),l=new tC.Fog(e.fogColor,t,a);return r.fog=l,o.current=l,(0,t9.updateGlobalFogUniforms)(n.position.y,i),()=>{r.fog=null,o.current=null,(0,t9.resetGlobalFogUniforms)()}},[r,n,e,i]),(0,a.useEffect)(()=>{let r=o.current;if(r)if(t){let[t,a]=rW(e,n.position.y);r.near=t,r.far=a}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,tw.useFrame)(()=>{let r=o.current;if(!r)return;let a=n.position.y;if((0,t9.updateGlobalFogUniforms)(a,i,t),t){let[t,n]=rW(e,a);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}let rO=(0,a.memo)(function({entity:e}){let{skyData:t}=e;rB.debug("Rendering: materialList=%s, useSkyTextures=%s",t.materialList,t.useSkyTextures);let{fogEnabled:n}=(0,_.useSettings)(),o=t.materialList||void 0,i=(0,a.useMemo)(()=>rA(t.skySolidColor),[t.skySolidColor]),l=t.useSkyTextures,s=(0,a.useMemo)(()=>(function(e){let t=e.fogDistance,r=e.visibleDistance>0?e.visibleDistance:1e3,{r:n,g:a,b:o}=e.fogColor,i=new tC.Color().setRGB(n,a,o).convertSRGBToLinear(),l=[];for(let t of e.fogVolumes)t.visibleDistance<=0||t.maxHeight<=t.minHeight||l.push({visibleDistance:t.visibleDistance,minHeight:t.minHeight,maxHeight:t.maxHeight,percentage:1});let s=l.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:t,visibleDistance:r,fogColor:i,fogVolumes:l,fogLine:s,enabled:r>t}})(t),[t]);rB.debug("fogState: fogColor=(%s, %s, %s) visibleDistance=%d fogDistance=%d enabled=%s volumes=%d",t.fogColor.r.toFixed(3),t.fogColor.g.toFixed(3),t.fogColor.b.toFixed(3),t.visibleDistance,t.fogDistance,s.enabled,s.fogVolumes.length);let c=(0,a.useMemo)(()=>rA(t.fogColor),[t.fogColor]),u=i||c,d=s.enabled&&n,m=s.fogColor,f=(0,tS.useThree)(e=>e.scene),h=(0,tS.useThree)(e=>e.gl);(0,a.useEffect)(()=>{if(d){let e=m.clone();f.background=e,h.setClearColor(e)}else if(u){let e=u[0].clone();f.background=e,h.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,h,d,m,u]);let p=i?.[1];return(0,r.jsxs)(r.Fragment,{children:[o&&l&&o.length>0?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rU,{materialList:o,fogColor:d?m:void 0,fogState:d?s:void 0},o)}):p?(0,r.jsx)(rG,{skyColor:p,fogColor:d?m:void 0,fogState:d?s:void 0}):null,(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(rF,{scene:t})}),s.enabled?(0,r.jsx)(rH,{fogState:s,enabled:n}):null]})});function rV(e){let t,o=(0,n.c)(3),{children:i}=e,{audioEnabled:l}=(0,_.useSettings)();return o[0]!==l||o[1]!==i?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=l,o[1]=i,o[2]=t):t=o[2],t}function rq(e,t){let o=(0,a.lazy)(()=>t().then(t=>({default:t[e]}))),i=t=>{let a,i,l=(0,n.c)(5),{entity:s}=t,c=`${e}:${s.id}`;return l[0]!==s?(a=(0,r.jsx)(o,{entity:s}),l[0]=s,l[1]=a):a=l[1],l[2]!==c||l[3]!==a?(i=(0,r.jsx)(tQ.DebugSuspense,{name:c,children:a}),l[2]=c,l[3]=a,l[4]=i):i=l[4],i};return i.displayName=`createLazy(${e})`,i}let r$=rq("PlayerModel",()=>e.A(30814)),rK=rq("ExplosionShape",()=>e.A(44325)),rQ=rq("TracerProjectile",()=>e.A(62125)),rY=rq("SpriteProjectile",()=>e.A(62125)),rX=rq("ForceFieldBare",()=>e.A(25147)),rZ=rq("AudioEmitter",()=>e.A(61921)),rJ=rq("WaterBlock",()=>e.A(18599)),r0=rq("WeaponModel",()=>e.A(44325)),r1={1:"Storm",2:"Inferno"},r2=(0,a.memo)(function(e){let t=(0,n.c)(26),{entity:a}=e;switch(a.renderType){case"Shape":{let e;return t[0]!==a?(e=(0,r.jsx)(r3,{entity:a}),t[0]=a,t[1]=e):e=t[1],e}case"ForceFieldBare":{let e;return t[2]!==a?(e=(0,r.jsx)(rX,{entity:a}),t[2]=a,t[3]=e):e=t[3],e}case"Player":{let e;return t[4]!==a?(e=(0,r.jsx)(r$,{entity:a}),t[4]=a,t[5]=e):e=t[5],e}case"Explosion":{let e;return t[6]!==a?(e=(0,r.jsx)(rK,{entity:a}),t[6]=a,t[7]=e):e=t[7],e}case"Tracer":{let e;return t[8]!==a?(e=(0,r.jsx)(rQ,{entity:a}),t[8]=a,t[9]=e):e=t[9],e}case"Sprite":{let e;return t[10]!==a?(e=(0,r.jsx)(rY,{entity:a}),t[10]=a,t[11]=e):e=t[11],e}case"AudioEmitter":{let e;return t[12]!==a?(e=(0,r.jsx)(rV,{children:(0,r.jsx)(rZ,{entity:a})}),t[12]=a,t[13]=e):e=t[13],e}case"Camera":{let e;return t[14]!==a?(e=(0,r.jsx)(tZ,{entity:a}),t[14]=a,t[15]=e):e=t[15],e}case"WayPoint":{let e;return t[16]!==a?(e=(0,r.jsx)(tJ,{entity:a}),t[16]=a,t[17]=e):e=t[17],e}case"TerrainBlock":{let e;return t[18]!==a.terrainData?(e=(0,r.jsx)(rl,{scene:a.terrainData}),t[18]=a.terrainData,t[19]=e):e=t[19],e}case"InteriorInstance":{let e;return t[20]!==a.interiorData?(e=(0,r.jsx)(rw,{scene:a.interiorData}),t[20]=a.interiorData,t[21]=e):e=t[21],e}case"Sky":{let e;return t[22]!==a?(e=(0,r.jsx)(rO,{entity:a}),t[22]=a,t[23]=e):e=t[23],e}case"Sun":case"MissionArea":case"None":default:return null;case"WaterBlock":{let e;return t[24]!==a?(e=(0,r.jsx)(rJ,{entity:a}),t[24]=a,t[25]=e):e=t[25],e}}});function r3(e){let t,o,i,l,s,c,u,d=(0,n.c)(24),{entity:m}=e,{animationEnabled:f}=(0,_.useSettings)(),h=(0,a.useRef)(null);if(d[0]!==f||d[1]!==m.rotate?(t=()=>{if(!h.current||!m.rotate||!f)return;let e=performance.now()/1e3;h.current.rotation.y=e/3*Math.PI*2},d[0]=f,d[1]=m.rotate,d[2]=t):t=d[2],(0,tw.useFrame)(t),!m.shapeName)throw Error(`Shape entity missing shapeName: ${m.id}`);let p=m.runtimeObject,g=m.shapeType??"StaticShape",v=m.dataBlock?.toLowerCase()==="flag",x=m.teamId&&m.teamId>0?r1[m.teamId]:null,y=v&&x?`${x} Flag`:null,b="Item"===m.shapeType?"pink":m.threads?"#00ff88":"yellow",S=m.rotate?h:void 0,w=p?void 0:m;return d[3]!==y?(o=y?(0,r.jsx)(tX.FloatingLabel,{opacity:.6,children:y}):null,d[3]=y,d[4]=o):o=d[4],d[5]!==b||d[6]!==w||d[7]!==o?(i=(0,r.jsx)(t$.ShapeRenderer,{loadingColor:b,streamEntity:w,children:o}),d[5]=b,d[6]=w,d[7]=o,d[8]=i):i=d[8],d[9]!==m.barrelShapeName||d[10]!==p?(l=m.barrelShapeName&&(0,r.jsx)(tK.ShapeInfoProvider,{object:p,shapeName:m.barrelShapeName,type:"Turret",children:(0,r.jsx)("group",{position:[0,1.5,0],children:(0,r.jsx)(t$.ShapeRenderer,{})})}),d[9]=m.barrelShapeName,d[10]=p,d[11]=l):l=d[11],d[12]!==m?(s=m.weaponShape&&(0,r.jsx)(tY.ShapeErrorBoundary,{fallback:(0,r.jsx)(t$.ShapePlaceholder,{color:"red",label:m.weaponShape}),children:(0,r.jsx)(tQ.DebugSuspense,{name:`Weapon:${m.id}/${m.weaponShape}`,fallback:(0,r.jsx)(t$.ShapePlaceholder,{color:"cyan",label:m.weaponShape}),children:(0,r.jsx)(r0,{entity:m})})}),d[12]=m,d[13]=s):s=d[13],d[14]!==S||d[15]!==i||d[16]!==l||d[17]!==s?(c=(0,r.jsxs)("group",{ref:S,children:[i,l,s]}),d[14]=S,d[15]=i,d[16]=l,d[17]=s,d[18]=c):c=d[18],d[19]!==m.shapeName||d[20]!==g||d[21]!==c||d[22]!==p?(u=(0,r.jsx)(tK.ShapeInfoProvider,{object:p,shapeName:m.shapeName,type:g,children:c}),d[19]=m.shapeName,d[20]=g,d[21]=c,d[22]=p,d[23]=u):u=d[23],u}var r5=e.i(60099),r4=e.i(85557),r6=e.i(29418);let r8=(0,t2.textureToUrl)("gui/hud_alliedtriangle"),r7=(0,t2.textureToUrl)("gui/hud_enemytriangle"),r9=new tC.Vector3,ne=[];function nt(e){let t,o,i,l,s,c=(0,n.c)(21),{entity:u}=e,d=(0,t$.useStaticShape)(u.shapeName??u.dataBlock),m=(0,tS.useThree)(nn),f=(0,a.useRef)(null),h=(0,a.useRef)(null),p=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(null),[x,y]=(0,a.useState)(!0),b=(0,a.useRef)(null);c[0]!==d.scene?(t=new tC.Box3().setFromObject(d.scene),c[0]=d.scene,c[1]=t):t=c[1];let _=t.max.y+.1,S=u.keyframes??ne;c[2]!==S?(o=S.some(nr),c[2]=S,c[3]=o):o=c[3];let w=o;c[4]!==m||c[5]!==u.id||c[6]!==u.iffColor||c[7]!==u.playerName||c[8]!==w||c[9]!==x||c[10]!==S?(i=()=>{let e=f.current;if(!e)return;e.getWorldPosition(r9);let t=m.position.distanceTo(r9),r=m.matrixWorld.elements,n=!(-((r9.x-r[12])*r[8])+-((r9.y-r[13])*r[9])+-((r9.z-r[14])*r[10])<0)&&t<150;if(x!==n&&y(n),!n)return;let a=(0,r4.getKeyframeAtTime)(S,tD.streamPlaybackStore.getState().time),o=a?.health??1;if(a?.damageState!=null&&a.damageState>=1){h.current&&(h.current.style.opacity="0"),p.current&&(p.current.style.opacity="0");return}let i=Math.max(0,Math.min(1,1-t/150)).toString();if(h.current&&(h.current.style.opacity=i),p.current&&(p.current.style.opacity=i),b.current){let e=u.playerName??u.id;b.current.textContent!==e&&(b.current.textContent=e)}if(v.current&&u.iffColor){let e=u.iffColor.r>u.iffColor.g?r7:r8;v.current.getAttribute("src")!==e&&(v.current.src=e)}g.current&&w&&(g.current.style.width=`${Math.max(0,Math.min(100,100*o))}%`,g.current.style.background=u.iffColor?`rgb(${u.iffColor.r}, ${u.iffColor.g}, ${u.iffColor.b})`:"")},c[4]=m,c[5]=u.id,c[6]=u.iffColor,c[7]=u.playerName,c[8]=w,c[9]=x,c[10]=S,c[11]=i):i=c[11],(0,tw.useFrame)(i);let C=u.iffColor&&u.iffColor.r>u.iffColor.g?r7:r8;return c[12]!==u.id||c[13]!==u.playerName||c[14]!==w||c[15]!==_||c[16]!==C||c[17]!==x?(l=x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(r5.Html,{position:[0,_,0],center:!0,children:(0,r.jsx)("div",{ref:h,className:r6.default.Top,children:(0,r.jsx)("img",{ref:v,className:r6.default.IffArrow,src:C,alt:""})})}),(0,r.jsx)(r5.Html,{position:[0,-.2,0],center:!0,children:(0,r.jsxs)("div",{ref:p,className:r6.default.Bottom,children:[(0,r.jsx)("div",{ref:b,className:r6.default.Name,children:u.playerName??u.id}),w&&(0,r.jsx)("div",{className:r6.default.HealthBar,children:(0,r.jsx)("div",{ref:g,className:r6.default.HealthFill})})]})})]}),c[12]=u.id,c[13]=u.playerName,c[14]=w,c[15]=_,c[16]=C,c[17]=x,c[18]=l):l=c[18],c[19]!==l?(s=(0,r.jsx)("group",{ref:f,children:l}),c[19]=l,c[20]=s):s=c[20],s}function nr(e){return null!=e.health}function nn(e){return e.camera}var na=e.i(78779);let no=(0,t2.textureToUrl)("commander/MiniIcons/com_flag_grey"),ni=new tC.Vector3;function nl(e){let t,o,i,l,s,c=(0,n.c)(9),{entity:u}=e,d=(0,a.useRef)(null),m=(0,a.useRef)(null),f=(0,a.useRef)(null),h=(0,tS.useThree)(ns);c[0]!==h||c[1]!==u.iffColor?(t=()=>{if(m.current&&u.iffColor){let{r:e,g:t,b:r}=u.iffColor;m.current.style.backgroundColor=`rgb(${e},${t},${r})`}if(f.current&&d.current){d.current.getWorldPosition(ni);let e=h.position.distanceTo(ni);f.current.textContent=e.toFixed(1)}},c[0]=h,c[1]=u.iffColor,c[2]=t):t=c[2],(0,tw.useFrame)(t);let p=u.iffColor?`rgb(${u.iffColor.r},${u.iffColor.g},${u.iffColor.b})`:"rgb(200,200,200)";c[3]===Symbol.for("react.memo_cache_sentinel")?(o=[0,1.5,0],c[3]=o):o=c[3],c[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)("span",{ref:f,className:na.default.Distance}),c[4]=i):i=c[4],c[5]!==p?(l={backgroundColor:p,"--flag-icon-url":`url(${no})`},c[5]=p,c[6]=l):l=c[6];let g=l;return c[7]!==g?(s=(0,r.jsx)("group",{ref:d,children:(0,r.jsx)(r5.Html,{position:o,center:!0,children:(0,r.jsxs)("div",{className:na.default.Root,children:[i,(0,r.jsx)("div",{ref:m,className:na.default.Icon,style:g})]})})}),c[7]=g,c[8]=s):s=c[8],s}function ns(e){return e.camera}function nc(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("group",{ref:nu,children:(0,r.jsx)(nd,{})}),t[0]=e):e=t[0],e}function nu(e){tD.streamPlaybackStore.setState({root:e})}let nd=(0,a.memo)(function(){let e=(0,eX.useAllGameEntities)(),t=(0,a.useRef)(new Map).current,n=new Set;for(let r of e)n.add(r.id),t.set(r.id,r);for(let e of t.keys())n.has(e)||t.delete(e);return(0,r.jsx)(r.Fragment,{children:[...t.values()].map(e=>(0,r.jsx)(nm,{entity:e},e.id))})}),nm=(0,a.memo)(function(e){let t,a=(0,n.c)(7),{entity:o}=e;if((0,tq.isSceneEntity)(o)){let e,t;return a[0]!==o?(e=(0,r.jsx)(r2,{entity:o}),a[0]=o,a[1]=e):e=a[1],a[2]!==o.id||a[3]!==e?(t=(0,r.jsx)("group",{name:o.id,children:e}),a[2]=o.id,a[3]=e,a[4]=t):t=a[4],t}return"None"===o.renderType?null:(a[5]!==o?(t=(0,r.jsx)(ng,{entity:o}),a[5]=o,a[6]=t):t=a[6],t)});function nf(e){let t,a=(0,n.c)(2),{entity:o}=e,i=(0,th.useEngineSelector)(nh);return o.id===i?null:(a[0]!==o?(t=(0,r.jsx)(nt,{entity:o}),a[0]=o,a[1]=t):t=a[1],t)}function nh(e){return e.playback.streamSnapshot?.controlPlayerGhostId}function np({entity:e}){let t=(0,a.useRef)(!1),[n,o]=(0,a.useState)(()=>((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0);return(t.current=n,(0,tw.useFrame)(()=>{let r=((("targetRenderFlags"in e?e.targetRenderFlags:void 0)??0)&2)!=0;r!==t.current&&(t.current=r,o(r))}),n)?(0,r.jsx)(nl,{entity:e}):null}function ng(e){let t,a,o,i,l,s,c,u,d=(0,n.c)(39),{entity:m}=e,f=m.position,h=m.scale;e:{let e;if(!m.rotation){t=void 0;break e}d[0]!==m.rotation?(e=new tC.Quaternion(...m.rotation),d[0]=m.rotation,d[1]=e):e=d[1],t=e}let p=t,g="Player"===m.renderType;if("Shape"===m.renderType&&!m.shapeName){let e,t,n,a,o,i=m.id;return d[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("sphereGeometry",{args:[.3,6,4]}),d[2]=e):e=d[2],d[3]!==m.className?(t=(0,r4.entityTypeColor)(m.className),d[3]=m.className,d[4]=t):t=d[4],d[5]!==t?(n=(0,r.jsxs)("mesh",{children:[e,(0,r.jsx)("meshBasicMaterial",{color:t,wireframe:!0})]}),d[5]=t,d[6]=n):n=d[6],d[7]!==m?(a=(0,r.jsx)(np,{entity:m}),d[7]=m,d[8]=a):a=d[8],d[9]!==m.id||d[10]!==f||d[11]!==p||d[12]!==h||d[13]!==n||d[14]!==a?(o=(0,r.jsxs)("group",{name:i,position:f,quaternion:p,scale:h,children:[n,a]}),d[9]=m.id,d[10]=f,d[11]=p,d[12]=h,d[13]=n,d[14]=a,d[15]=o):o=d[15],o}d[16]!==m.className||d[17]!==m.renderType?(a="Explosion"===m.renderType?null:(0,r.jsxs)("mesh",{children:[(0,r.jsx)("sphereGeometry",{args:[.5,8,6]}),(0,r.jsx)("meshBasicMaterial",{color:(0,r4.entityTypeColor)(m.className),wireframe:!0})]}),d[16]=m.className,d[17]=m.renderType,d[18]=a):a=d[18];let v=a;return d[19]!==m?(o=(0,r.jsx)(r2,{entity:m}),d[19]=m,d[20]=o):o=d[20],d[21]!==v||d[22]!==o?(i=(0,r.jsx)(tY.ShapeErrorBoundary,{fallback:v,children:o}),d[21]=v,d[22]=o,d[23]=i):i=d[23],d[24]!==m||d[25]!==g?(l=g&&(0,r.jsx)(nf,{entity:m}),d[24]=m,d[25]=g,d[26]=l):l=d[26],d[27]!==m?(s=(0,r.jsx)(np,{entity:m}),d[27]=m,d[28]=s):s=d[28],d[29]!==i||d[30]!==l||d[31]!==s?(c=(0,r.jsxs)("group",{name:"model",children:[i,l,s]}),d[29]=i,d[30]=l,d[31]=s,d[32]=c):c=d[32],d[33]!==m.id||d[34]!==f||d[35]!==p||d[36]!==h||d[37]!==c?(u=(0,r.jsx)("group",{name:m.id,position:f,quaternion:p,scale:h,children:c}),d[33]=m.id,d[34]=f,d[35]=p,d[36]=h,d[37]=c,d[38]=u):u=d[38],u}let nv=(0,M.createLogger)("SceneLighting");function nx(){let e,t,o,i=(0,n.c)(6),l=(0,eX.useSceneSun)();if(i[0]!==l?(e=()=>{l?nv.debug("sunData: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)",l.direction.x.toFixed(3),l.direction.y.toFixed(3),l.direction.z.toFixed(3),l.color.r.toFixed(3),l.color.g.toFixed(3),l.color.b.toFixed(3),l.ambient.r.toFixed(3),l.ambient.g.toFixed(3),l.ambient.b.toFixed(3)):nv.debug("No sunData — using fallback ambient #888")},t=[l],i[0]=l,i[1]=e,i[2]=t):(e=i[1],t=i[2]),(0,a.useEffect)(e,t),!l){let e;return i[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("ambientLight",{color:"#888888",intensity:1}),i[3]=e):e=i[3],e}return i[4]!==l?(o=(0,r.jsx)(ny,{sunData:l}),i[4]=l,i[5]=o):o=i[5],o}function ny(e){let t,o,i,l,s,c,u,d,m,f,h=(0,n.c)(29),{sunData:p}=e;h[0]!==p.direction?(t=(0,t1.torqueToThree)(p.direction),h[0]=p.direction,h[1]=t):t=h[1];let[g,v,x]=t,y=Math.sqrt(g*g+v*v+x*x),b=g/y,_=v/y,S=x/y;h[2]!==b||h[3]!==_||h[4]!==S?(o=new tC.Vector3(b,_,S),h[2]=b,h[3]=_,h[4]=S,h[5]=o):o=h[5];let w=o,C=-(5e3*w.x),j=-(5e3*w.y),M=-(5e3*w.z);h[6]!==C||h[7]!==j||h[8]!==M?(i=new tC.Vector3(C,j,M),h[6]=C,h[7]=j,h[8]=M,h[9]=i):i=h[9];let k=i;h[10]!==p.color.b||h[11]!==p.color.g||h[12]!==p.color.r?(l=new tC.Color(p.color.r,p.color.g,p.color.b),h[10]=p.color.b,h[11]=p.color.g,h[12]=p.color.r,h[13]=l):l=h[13];let T=l;h[14]!==p.ambient.b||h[15]!==p.ambient.g||h[16]!==p.ambient.r?(s=new tC.Color(p.ambient.r,p.ambient.g,p.ambient.b),h[14]=p.ambient.b,h[15]=p.ambient.g,h[16]=p.ambient.r,h[17]=s):s=h[17];let N=s,R=w.y<0;return h[18]!==R?(c=()=>{t4.value=R},u=[R],h[18]=R,h[19]=c,h[20]=u):(c=h[19],u=h[20]),(0,a.useEffect)(c,u),h[21]!==T||h[22]!==k?(d=(0,r.jsx)("directionalLight",{position:k,color:T,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),h[21]=T,h[22]=k,h[23]=d):d=h[23],h[24]!==N?(m=(0,r.jsx)("ambientLight",{color:N,intensity:1}),h[24]=N,h[25]=m):m=h[25],h[26]!==d||h[27]!==m?(f=(0,r.jsxs)(r.Fragment,{children:[d,m]}),h[26]=d,h[27]=m,h[28]=f):f=h[28],f}function nb(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo,delete window.loadDemoRecording}var n_=e.i(74657),nS=e.i(75056);let nw={toneMapping:tC.NoToneMapping,outputColorSpace:tC.SRGBColorSpace};function nC(e){let t,a,o=(0,n.c)(6),{children:i,renderOnDemand:l,dpr:s,onCreated:c}=e,{renderOnDemand:u}=(0,_.useDebug)(),d=void 0!==l&&l||u?"demand":"always";return o[0]===Symbol.for("react.memo_cache_sentinel")?(t={type:tC.PCFShadowMap},o[0]=t):t=o[0],o[1]!==i||o[2]!==s||o[3]!==c||o[4]!==d?(a=(0,r.jsx)(nS.Canvas,{frameloop:d,dpr:s,gl:nw,shadows:t,onCreated:c,children:i}),o[1]=i,o[2]=s,o[3]=c,o[4]=d,o[5]=a):a=o[5],a}var nj=e.i(12631),nM=e.i(66093),nk=e.i(85413),nT=Object.defineProperty,nN=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?nT(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let nR=new tC.Euler(0,0,0,"YXZ"),nD=new tC.Vector3,nL={type:"change"},nF={type:"lock"},nI={type:"unlock"},nE=Math.PI/2;class nB extends nk.EventDispatcher{constructor(e,t){super(),nN(this,"camera"),nN(this,"domElement"),nN(this,"isLocked"),nN(this,"minPolarAngle"),nN(this,"maxPolarAngle"),nN(this,"pointerSpeed"),nN(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nR.setFromQuaternion(this.camera.quaternion),nR.y-=.002*e.movementX*this.pointerSpeed,nR.x-=.002*e.movementY*this.pointerSpeed,nR.x=Math.max(nE-this.maxPolarAngle,Math.min(nE-this.minPolarAngle,nR.x)),this.camera.quaternion.setFromEuler(nR),this.dispatchEvent(nL))}),nN(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(nF),this.isLocked=!0):(this.dispatchEvent(nI),this.isLocked=!1))}),nN(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),nN(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),nN(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),nN(this,"dispose",()=>{this.disconnect()}),nN(this,"getObject",()=>this.camera),nN(this,"direction",new tC.Vector3(0,0,-1)),nN(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),nN(this,"moveForward",e=>{nD.setFromMatrixColumn(this.camera.matrix,0),nD.crossVectors(this.camera.up,nD),this.camera.position.addScaledVector(nD,e)}),nN(this,"moveRight",e=>{nD.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(nD,e)}),nN(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),nN(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}(t={}).forward="forward",t.backward="backward",t.left="left",t.right="right",t.up="up",t.down="down",t.lookUp="lookUp",t.lookDown="lookDown",t.lookLeft="lookLeft",t.lookRight="lookRight",t.camera1="camera1",t.camera2="camera2",t.camera3="camera3",t.camera4="camera4",t.camera5="camera5",t.camera6="camera6",t.camera7="camera7",t.camera8="camera8",t.camera9="camera9";let nP=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"lookUp",keys:["ArrowUp"]},{name:"lookDown",keys:["ArrowDown"]},{name:"lookLeft",keys:["ArrowLeft"]},{name:"lookRight",keys:["ArrowRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function nA(){let e,t,r,o,i,l,s,c,u,d,m,f,h,p,g,v=(0,n.c)(41);v[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],v[0]=e):e=v[0],(0,a.useEffect)(nG,e);let{speedMultiplier:x,setSpeedMultiplier:y,invertScroll:b,invertDrag:S}=(0,_.useControls)(),{onInput:w,mode:C}=(0,tL.useInputContext)(),[j,M]=(0,nj.useKeyboardControls)(),k=(0,tS.useThree)(nU),T=(0,tS.useThree)(nz),{nextCamera:N,setCameraIndex:R,cameraCount:D}=tN(),L=(0,a.useRef)(null);v[1]!==b?(t=()=>b,v[1]=b,v[2]=t):t=v[2];let F=(0,a.useEffectEvent)(t);v[3]!==S?(r=()=>S,v[3]=S,v[4]=r):r=v[4];let I=(0,a.useEffectEvent)(r);v[5]!==C?(o=()=>C,v[5]=C,v[6]=o):o=v[6];let E=(0,a.useEffectEvent)(o),B=(0,a.useRef)(0),P=(0,a.useRef)(0),A=(0,a.useRef)(!1),z=(0,a.useRef)(!1);return v[7]!==k||v[8]!==T.domElement?(i=()=>{let e=new nB(k,T.domElement);return L.current=e,()=>{e.dispose()}},l=[k,T.domElement],v[7]=k,v[8]=T.domElement,v[9]=i,v[10]=l):(i=v[9],l=v[10]),(0,a.useEffect)(i,l),v[11]!==I||v[12]!==E||v[13]!==T.domElement||v[14]!==C||v[15]!==N?(s=()=>{let e=T.domElement,t=!1,r=!1,n=0,a=0,o=o=>{L.current?.isLocked||o.target===e&&(t=!0,r=!1,n=o.clientX,a=o.clientY)},i=e=>{if(L.current?.isLocked){B.current=B.current+.002*e.movementX,P.current=P.current+.002*e.movementY;return}if(!t||!r&&3>Math.abs(e.clientX-n)&&3>Math.abs(e.clientY-a))return;r=!0;let o="follow"===E()?-1:1,i=(I()?1:-1)*o;B.current=B.current+i*e.movementX*.002,P.current=P.current+i*e.movementY*.002},l=()=>{t=!1},s=t=>{let n=L.current;n?.isLocked?"follow"===C?A.current=!0:"local"===C&&N():t.target!==e||r||n?.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",i),document.addEventListener("mouseup",l),document.addEventListener("click",s),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),document.removeEventListener("click",s)}},v[11]=I,v[12]=E,v[13]=T.domElement,v[14]=C,v[15]=N,v[16]=s):s=v[16],v[17]!==k||v[18]!==T.domElement||v[19]!==C||v[20]!==N?(c=[k,T.domElement,N,C],v[17]=k,v[18]=T.domElement,v[19]=C,v[20]=N,v[21]=c):c=v[21],(0,a.useEffect)(s,c),v[22]!==D||v[23]!==R||v[24]!==j?(u=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return j(t=>{for(let r=0;r<e.length;r++)if(t[e[r]]&&r<D){R(r);break}})},d=[j,R,D],v[22]=D,v[23]=R,v[24]=j,v[25]=u,v[26]=d):(u=v[25],d=v[26]),(0,a.useEffect)(u,d),v[27]!==F||v[28]!==T.domElement||v[29]!==y?(m=()=>{let e=e=>{e.preventDefault();let t=F()?-1:1,r=(e.deltaY>0?-1:1)*t,n=Math.max(2,Math.min(11,Math.ceil(Math.log2(Math.abs(e.deltaY)+1))))*r;y(e=>{let t=Math.round(100*e)+n;return Math.max(_.MIN_SPEED_MULTIPLIER,Math.min(_.MAX_SPEED_MULTIPLIER,t/100))})},t=T.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},v[27]=F,v[28]=T.domElement,v[29]=y,v[30]=m):m=v[30],v[31]!==T.domElement||v[32]!==y?(f=[T.domElement,y],v[31]=T.domElement,v[32]=y,v[33]=f):f=v[33],(0,a.useEffect)(m,f),v[34]!==C?(h=()=>{if("local"===C)return;let e=e=>{if("KeyO"!==e.code||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(z.current=!0)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},p=[C],v[34]=C,v[35]=h,v[36]=p):(h=v[35],p=v[36]),(0,a.useEffect)(h,p),v[37]!==M||v[38]!==w||v[39]!==x?(g=(e,t)=>{let{forward:r,backward:n,left:a,right:o,up:i,down:l,lookUp:s,lookDown:c,lookLeft:u,lookRight:d}=M(),m=B.current,f=P.current;B.current=0,P.current=0,u&&(m-=t),d&&(m+=+t),s&&(f-=t),c&&(f+=+t);let h=0,p=0,g=0;a&&(h=-1),o&&(h+=1),r&&(p=1),n&&(p-=1),i&&(g=1),l&&(g-=1);let v=(Math.round(15*((x-_.MIN_SPEED_MULTIPLIER)/(1-_.MIN_SPEED_MULTIPLIER)))+1)/16;h=Math.max(-1,Math.min(1,h*v)),p=Math.max(-1,Math.min(1,p*v)),g=Math.max(-1,Math.min(1,g*v));let y=[!1,!1,!1,!1,!1,!1];A.current&&(y[0]=!0,A.current=!1),z.current&&(y[2]=!0,z.current=!1);let b=0!==m||0!==f,S=0!==h||0!==p||0!==g,C=y.some(Boolean);(b||S||C)&&w({deltaYaw:m,deltaPitch:f,x:h,y:p,z:g,triggers:y,delta:t})},v[37]=M,v[38]=w,v[39]=x,v[40]=g):g=v[40],(0,tw.useFrame)(g),null}function nz(e){return e.gl}function nU(e){return e.camera}function nG(){return window.addEventListener("keydown",nW,{capture:!0}),window.addEventListener("keyup",nW,{capture:!0}),()=>{window.removeEventListener("keydown",nW,{capture:!0}),window.removeEventListener("keyup",nW,{capture:!0})}}function nW(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}let nH=(0,a.lazy)(()=>e.A(34019).then(e=>({default:e.TouchHandler})));function nO(e){let t,o,i,l,s,c=(0,n.c)(9),{children:u}=e;c[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],c[0]=t):t=c[0];let d=(0,a.useRef)(t),[m,f]=(0,a.useState)("local");c[1]===Symbol.for("react.memo_cache_sentinel")?(o=e=>{d.current.push(e)},c[1]=o):o=c[1];let h=o;return c[2]!==m?(i={moveQueue:d,onInput:h,mode:m,setMode:f},c[2]=m,c[3]=i):i=c[3],c[4]!==u?(l=(0,r.jsx)(nj.KeyboardControls,{map:nP,children:(0,r.jsx)(nM.JoystickProvider,{children:u})}),c[4]=u,c[5]=l):l=c[5],c[6]!==i||c[7]!==l?(s=(0,r.jsx)(tL.InputContext.Provider,{value:i,children:l}),c[6]=i,c[7]=l,c[8]=s):s=c[8],s}function nV(){let e,t,o,i=(0,n.c)(5),l=(0,eY.useTouchDevice)();return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(nA,{}),i[0]=e):e=i[0],i[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nH,{})}):null,i[1]=l,i[2]=t):t=i[2],i[3]!==t?(o=(0,r.jsxs)(r.Fragment,{children:[e,t]}),i[3]=t,i[4]=o):o=i[4],o}let nq=(0,a.lazy)(()=>e.A(553).then(e=>({default:e.TouchJoystick}))),n$=(0,a.lazy)(()=>e.A(33487).then(e=>({default:e.KeyboardOverlay})));function nK(){let e,t,o,i=(0,n.c)(7),l=(0,eY.useTouchDevice)();return i[0]!==l?(e=l?(0,r.jsx)(nq,{}):null,i[0]=l,i[1]=e):e=i[1],i[2]!==l?(t=!1===l?(0,r.jsx)(n$,{}):null,i[2]=l,i[3]=t):t=i[3],i[4]!==e||i[5]!==t?(o=(0,r.jsxs)(a.Suspense,{children:[e,t]}),i[4]=e,i[5]=t,i[6]=o):o=i[6],o}var nQ=e.i(89271);function nY(e){let t,a,o,i,l,s=(0,n.c)(11),{isLoading:c,progress:u}=e,d=!c;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:nQ.default.Spinner}),s[0]=t):t=s[0];let m=`${100*u}%`;return s[1]!==m?(a=(0,r.jsx)("div",{className:nQ.default.Progress,children:(0,r.jsx)("div",{className:nQ.default.ProgressBar,style:{width:m}})}),s[1]=m,s[2]=a):a=s[2],s[3]!==u?(o=Math.round(100*u),s[3]=u,s[4]=o):o=s[4],s[5]!==o?(i=(0,r.jsxs)("div",{className:nQ.default.ProgressText,children:[o,"%"]}),s[5]=o,s[6]=i):i=s[6],s[7]!==d||s[8]!==a||s[9]!==i?(l=(0,r.jsxs)("div",{className:nQ.default.LoadingIndicator,"data-complete":d,children:[t,a,i]}),s[7]=d,s[8]=a,s[9]=i,s[10]=l):l=s[10],l}function nX(e){let t,o=(0,n.c)(3),{children:i}=e,{debugMode:l}=(0,_.useDebug)();return o[0]!==i||o[1]!==l?(t=l?(0,r.jsx)(a.Suspense,{children:i}):null,o[0]=i,o[1]=l,o[2]=t):t=o[2],t}var nZ=e.i(82156);function nJ(e,t){return(0,a.lazy)(()=>t().then(t=>({default:t[e]})))}let n0=nJ("StreamingController",()=>e.A(25483)),n1=nJ("DemoPlaybackControls",()=>e.A(93884)),n2=nJ("DebugElements",()=>e.A(88487)),n3=nJ("Mission",()=>e.A(21683)),n5=nJ("ChatSoundPlayer",()=>e.A(38496)),n4=nJ("PlayerHUD",()=>e.A(57567)),n6=nJ("MapInfoDialog",()=>e.A(59197)),n8=nJ("ServerBrowser",()=>e.A(70012));function n7(){let[e,t]=(0,n_.useMissionQueryState)(),o=(0,a.useContext)(s),{clearFogEnabledOverride:i,sidebarOpen:l,setSidebarOpen:c}=(0,_.useSettings)(),{missionName:u,missionType:d}=e,[m,f]=(0,a.useState)(!1),[h,p]=(0,a.useState)(!1),[g,S]=(0,a.useState)(!1),[w,C]=(0,a.useState)(0),[j,M]=(0,a.useState)(!0),N=(0,eY.useTouchDevice)(),R=(0,a.useCallback)(e=>{window.location.hash="",i(),S(!1);let r=k.liveConnectionStore.getState();r.disconnectServer(),r.disconnectRelay(),th.engineStore.getState().setRecording(null),eX.gameEntityStore.getState().endStreaming(),t(e),N&&c(!1)},[i,t,N,c]);!function(e){let t,r,o=(0,n.c)(5),{onChangeMission:i}=e,{setRecording:l}=(0,T.usePlaybackActions)(),s=(0,a.useEffectEvent)(i);o[0]!==s||o[1]!==l?(t=()=>(window.setMissionName=e=>{let t=(0,eZ.getMissionInfo)(e).missionTypes;s({missionName:e,missionType:t[0]})},window.getMissionList=eZ.getMissionList,window.getMissionInfo=eZ.getMissionInfo,window.loadDemoRecording=l,nb),o[0]=s,o[1]=l,o[2]=t):t=o[2],o[3]!==l?(r=[l],o[3]=l,o[4]=r):r=o[4],(0,a.useEffect)(t,r)}({onChangeMission:R});let D=(0,T.useRecording)(),L=(0,eX.useDataSource)(),F="demo"===L||"live"===L,I=(0,eX.useMissionName)(),E=(0,eX.useMissionType)();(0,a.useEffect)(()=>{if(F&&I)try{let e=(0,eZ.getMissionInfo)(I),r=E&&e.missionTypes.includes(E)?E:void 0;t({missionName:I,missionType:r})}catch{t(null)}},[F,I,E,t]),(0,a.useEffect)(()=>{D&&S(!1)},[D]);let B=(0,k.useLiveSelector)(e=>e.gameStatus);(0,a.useEffect)(()=>{"connected"===B&&N&&c(!1)},[B,N,c]),(0,a.useEffect)(()=>{D&&N&&c(!1)},[N,D,c]);let P=w<1;(0,a.useEffect)(()=>{if(P)M(!0);else{let e=setTimeout(()=>M(!1),500);return()=>clearTimeout(e)}},[P]);let A=(0,a.useCallback)((e,t=0)=>{C(t)},[]),z=(0,a.useRef)(null),U=(0,a.useRef)(null);return(0,r.jsx)("main",{className:nZ.default.Frame,children:(0,r.jsxs)(T.RecordingProvider,{children:[(0,r.jsxs)("header",{className:nZ.default.Toolbar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("button",{type:"button",className:nZ.default.ToggleSidebarButton,"data-orientation":"top","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(y,{}):(0,r.jsx)(b,{})}),(0,r.jsx)("button",{type:"button",className:nZ.default.ToggleSidebarButton,"data-orientation":"left","aria-label":l?"Close sidebar":"Open sidebar",title:l?"Close sidebar":"Open sidebar",onClick:e=>{(0,a.startTransition)(()=>c(e=>!e))},children:l?(0,r.jsx)(v,{}):(0,r.jsx)(x,{})}),(0,r.jsx)(a.Activity,{mode:F&&!g?"visible":"hidden",children:(0,r.jsx)(tv,{})}),(0,r.jsxs)(a.Activity,{mode:!F||g?"visible":"hidden",children:[(0,r.jsx)(tf,{value:g?"":u,missionType:g?"":d,onChange:R,autoFocus:g}),g&&(0,r.jsx)("button",{type:"button",className:nZ.default.CancelButton,onClick:()=>{S(!1)},children:"Cancel"})]})]}),l?(0,r.jsx)("div",{className:nZ.default.Backdrop}):null,(0,r.jsx)(a.Activity,{mode:l?"visible":"hidden",children:(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)("div",{className:nZ.default.Sidebar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-open":l,children:(0,r.jsx)(e0,{missionName:u,missionType:d,onOpenMapInfo:()=>f(!0),onOpenServerBrowser:o.live?()=>p(!0):void 0,onChooseMap:F?()=>{S(!0)}:void 0,onCancelChoosingMap:()=>{S(!1)},choosingMap:g,cameraRef:z,invalidateRef:U})})})}),(0,r.jsx)(nO,{children:(0,r.jsxs)("div",{className:nZ.default.Content,children:[(0,r.jsx)("div",{className:nZ.default.ThreeView,children:(0,r.jsx)(nC,{dpr:m||h?.25:void 0,onCreated:e=>{z.current=e.camera,U.current=e.invalidate},children:(0,r.jsx)(tF.TickProvider,{children:(0,r.jsxs)(tR,{children:[(0,r.jsx)(nV,{}),(0,r.jsxs)(tk.AudioProvider,{children:[(0,r.jsx)(nx,{}),(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(nc,{})}),(0,r.jsx)(tM,{}),(0,r.jsx)(rV,{children:(0,r.jsx)(n5,{})}),(0,r.jsx)(nX,{children:(0,r.jsx)(n2,{})}),D?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n0,{recording:D})}):null,F?null:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n3,{name:u,missionType:d,onLoadingChange:A},`${u}~${d}`)}),(0,r.jsx)(tV,{})]})]})})})}),F?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n4,{})}):null,(0,r.jsx)(nK,{}),j&&(0,r.jsx)(nY,{isLoading:P,progress:w})]})}),(0,r.jsx)("footer",{className:nZ.default.PlayerBar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:D?.source==="demo"?(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n1,{})}):null}),m?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n6,{onClose:()=>f(!1),missionName:u,missionType:d??""})})}):null,h?(0,r.jsx)(a.ViewTransition,{children:(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(n8,{onClose:()=>p(!1)})})}):null]})})}let n9=new o.QueryClient;function ae(){let e,t=(0,n.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(c,{children:(0,r.jsx)(i.QueryClientProvider,{client:n9,children:(0,r.jsx)(_.SettingsProvider,{children:(0,r.jsx)(n7,{})})})})}),t[0]=e):e=t[0],e}e.s(["default",()=>ae],31713)}]); |