const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/demoStreaming-DmedD6mI.js","assets/logger-CC5j_O4o.js","assets/chunk-DECur_0Z.js","assets/TouchHandler-DC30RPUy.js","assets/react-three-fiber.esm-IOIyqSDz.js","assets/jsx-runtime-BpGWiA-R.js","assets/three.module-BCXZgYUA.js","assets/traditional-ec-lUAFC.js","assets/SettingsProvider-BTNRdL6b.js","assets/manifest-DfHcIJuP.js","assets/TouchJoystick-Bqhkb-oZ.js","assets/preload-helper-4WkklRMx.js","assets/TouchJoystick-Dn73xHvm.css","assets/KeyboardOverlay-97AmC_to.js","assets/mission-CgOJ5O6t.js","assets/KeyboardControls-BqqT6pch.js","assets/engineStore-DYTudHqF.js","assets/KeyboardOverlay-By62YC1g.css","assets/GameView-xy7ylEXW.js","assets/extends-_1DzYWEQ.js","assets/GenericShape-C33K5pDg.js","assets/Texture-D0BO6ArI.js","assets/useBaseQuery-BpW2PYb8.js","assets/FloatingLabel-tmSmaRBa.js","assets/Html-CdWtT6bf.js","assets/FloatingLabel-DfptgH-Y.css","assets/globalFogUniforms-BmkrmymO.js","assets/loaders-YyTXpfdm.js","assets/useQuery-COJFCmDC.js","assets/AudioContext-zfBZ8gWo.js","assets/DebugSuspense-RneU-m3U.js","assets/ShapeErrorBoundary-BaXWF8jv.js","assets/gameEntityTypes-mMLHEa9z.js","assets/streamPlaybackStore-Dn9tWMRY.js","assets/GameView-PJcE9IRi.css","assets/DemoPlaybackControls-D6juVz-E.js","assets/DemoPlaybackControls-BQdLO79J.css","assets/PlayerHUD-BjRUZfwy.js","assets/PlayerHUD-DWwp2NIi.css","assets/MapInfoDialog-DeFCm6DR.js","assets/MapInfoDialog-D2SGBwUg.css","assets/ServerBrowser-Ng0eCpkZ.js","assets/ServerBrowser-BHjAKHLd.css","assets/ScoreScreen-CUK2P6bG.js","assets/iconBase-BCRUFbxq.js","assets/ScoreScreen-D-oysiIT.css"])))=>i.map(i=>d[i]); import{r as e,t}from"./chunk-DECur_0Z.js";import{n,r,t as i}from"./jsx-runtime-BpGWiA-R.js";import{i as a,o,s}from"./react-three-fiber.esm-IOIyqSDz.js";import{a as c,c as l,d as u,f as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./SettingsProvider-BTNRdL6b.js";import{t as S}from"./iconBase-BCRUFbxq.js";import{l as C,n as w,r as T,s as E}from"./manifest-DfHcIJuP.js";import{t as D}from"./logger-CC5j_O4o.js";import{i as O,n as k,r as A}from"./traditional-ec-lUAFC.js";import{Ht as j,T as M,tt as ee,xt as N}from"./three.module-BCXZgYUA.js";import{i as P}from"./mission-CgOJ5O6t.js";import{i as F,r as te}from"./engineStore-DYTudHqF.js";import{t as I}from"./preload-helper-4WkklRMx.js";import{n as ne,t as L}from"./KeyboardControls-BqqT6pch.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var R=t((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=R()})),z=t((e=>{var t=s(),n=r(),i=re();function a(e){var t=`https://react.dev/errors/`+e;if(1ne||(e.current=I[ne],I[ne]=null,ne--)}function z(e,t){ne++,I[ne]=e.current,e.current=t}var B=L(null),ie=L(null),V=L(null),H=L(null);function ae(e,t){switch(z(V,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function oe(){R(B),R(ie),R(V)}function se(e){e.memoizedState!==null&&z(H,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function ce(e){ie.current===e&&(R(B),R(ie)),H.current===e&&(R(H),Qf._currentValue=te)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1)`:-1i||c[r]!==l[i]){var u=` `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?de(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return e.child!==t&&t!==null?de(`Suspense Fallback`):de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return de(`Activity`);default:return``}}function he(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var ge=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,ye=t.unstable_shouldYield,be=t.unstable_requestPaint,xe=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,we=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Ee=t.unstable_LowPriority,De=t.unstable_IdlePriority,Oe=t.log,ke=t.unstable_setDisableYieldValue,Ae=null,je=null;function Me(e){if(typeof Oe==`function`&&ke(e),je&&typeof je.setStrictMode==`function`)try{je.setStrictMode(Ae,e)}catch{}}var Ne=Math.clz32?Math.clz32:Ie,Pe=Math.log,Fe=Math.LN2;function Ie(e){return e>>>=0,e===0?32:31-(Pe(e)/Fe|0)|0}var Le=256,Re=262144,ze=4194304;function Be(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ve(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Be(n))):i=Be(o):i=Be(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Be(n))):i=Be(o)):i=Be(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ue(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function We(){var e=ze;return ze<<=1,!(ze&62914560)&&(ze=4194304),e}function Ge(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),an=!1;if(rn)try{var on={};Object.defineProperty(on,`passive`,{get:function(){an=!0}}),window.addEventListener(`test`,on,on),window.removeEventListener(`test`,on,on)}catch{an=!1}var sn=null,cn=null,ln=null;function un(){if(ln)return ln;var e,t=cn,n=t.length,r,i=`value`in sn?sn.value:sn.textContent,a=i.length;for(e=0;e=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=un(),ln=cn=sn=null,Yn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=jt(e.document)}return t}function Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var wr=rn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==jt(r)||(r=Tr,`selectionStart`in r&&Cr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&vr(Dr,r)||(Dr=r,r=Td(Er,`onSelect`),0>=o,i-=o,xi=1<<32-Ne(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),W&&Ci(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),W&&Ci(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return W&&Ci(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),W&&Ci(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===v&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&Ca(l)===r.type){n(e,r.sibling),c=i(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===v?(c=ci(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=si(o.type,o.key,o.props,null,e.mode,c),Aa(c,o),c.return=e,e=c)}return s(e);case _:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=di(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=Ca(o),b(e,r,o,c)}if(N(o))return h(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ka(o),c);if(o.$$typeof===S)return b(e,r,Zi(e,o),c);ja(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=ca;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Y&f)===f:(r&f)===f){f!==0&&f===sa&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=P.T,s={};P.T=s,js(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,da(c,r),pu(e)):As(e,t,r,pu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Ss(e).queue;ys(e,i,t,te,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},pu())}function ws(){return Xi(Qf)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ra(n);var r=za(t,e,n);r!==null&&(hu(r,t,n),Ba(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Zr(e,t,n,r),n!==null&&(hu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,pu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,_r(s,o))return Xr(e,t,i,0),Rl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return hu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(a(479))}else t=Zr(e,n,r,2),t!==null&&hu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Fs={readContext:Xi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Xi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){Me(!0);try{e()}finally{Me(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){Me(!0);try{n(t)}finally{Me(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,G,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Eo();if(W){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Rl===null)throw Error(a(349));Y&127||Lo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Rl.identifierPrefix;if(W){var n=Si,r=xi;n=(r&~(1<<32-Ne(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[nt]=t,o[rt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=V.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Oi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ni(t,!0)}else e=Bd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[nt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(a(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[nt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),i=!1}else i=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return oe(),e===null&&xd(t.stateNode.containerInfo),Fc(t),null;case 10:return Wi(t.type),Fc(t),null;case 19:if(R(ao),r=t.memoizedState,r===null)return Fc(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)Pc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return z(ao,ao.current&1|2),W&&Ci(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&xe()>tu&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304)}else{if(!i)if(e=oo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!W)return Fc(t),null}else 2*xe()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=xe(),e.sibling=null,n=ao.current,z(ao,i?n&1|2:n&1),W&&Ci(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Fc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Lc(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),oe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ce(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(a(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ao),null;case 4:return oe(),null;case 10:return Wi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&R(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function Rc(e,t){switch(Ei(t),t.tag){case 3:Wi(na),oe();break;case 26:case 27:case 5:ce(t);break;case 4:oe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:R(ao);break;case 10:Wi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&R(pa);break;case 24:Wi(na)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Uu(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Uu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Uu(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Uu(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Uu(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Uu(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Uu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Uu(e,t,n)}else n.current=null}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Uu(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[rt]=t}catch(t){Uu(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Jt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Uu(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Rd=sp,e=Sr(e),Cr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[nt]=e,mt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=br(s,h),v=br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,P.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,Ll&6)throw Error(a(331));var c=Ll;if(Ll|=4,Nl(o.current),Tl(o,o.current,s,n),Ll=c,rd(0,!1),je&&typeof je.onPostCommitFiberRoot==`function`)try{je.onPostCommitFiberRoot(Ae,o)}catch{}return!0}finally{F.p=i,P.T=r,Q(e,t)}}function Hu(e,t,n){t=pi(n,t),t=Ys(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ke(e,2),nd(e))}function Uu(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=pi(n,e),n=Xs(2),r=za(t,n,2),r!==null&&(Zs(n,r,t,e),Ke(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Y&n)===n&&(Gl===4||Gl===3&&(Y&62914560)===Y&&300>xe()-$l?!(Ll&2)&&Su(e,0):Jl|=n,Xl===Y&&(Xl=0)),nd(e)}function Ku(e,t){t===0&&(t=We()),e=Qr(e,t),e!==null&&(Ke(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return _e(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ne(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=Y,a=Ve(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=xe(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}iu!==0&&iu!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Nt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Nt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Nt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Nt(n.imageSizes)+`"]`)):i+=`[href="`+Nt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Nt(r)+`"][href="`+Nt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),mt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=U(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);mt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=U(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=U(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=V.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=U(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=U(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=U(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+Nt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),mt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Nt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Nt(n.href)+`"]`);if(r)return t.instance=r,mt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),mt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,mt(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),mt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,mt(i),i):(r=n,(i=mf.get(o))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),mt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,mt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=z()})),ie=e(B(),1),V=e(r(),1),H=n();function ae(e,t,n){return r=>{if(!(t.length===0||t.some(t=>!x(r.getAll(t),e.getAll(t)))))return _("[nuqs `%s`] no change, returning previous",t.join(`,`),r),r;let i=oe(e,t,n);return _(`[nuqs \`%s\`] subbed search params change from %O to %O`,t.join(`,`),r,i),i}}function oe(e,t,n){if(t.length===0)return e;let r=n?new URLSearchParams(e):e;for(let n of e.keys())t.includes(n)||r.delete(n);return r}var se=`__nuqs__`,ce=u();function le(e){return function(t,n){let r=new URL(location.href);r.search=m(t),_(`[nuqs react] Updating url: %s`,r),e&&n.shallow===!1?(n.history===`push`?location.assign:location.replace).call(location,r):(n.history===`push`?history.pushState:history.replaceState).call(history,history.state,se,r),ce.emit(`update`,t),n.scroll===!0&&window.scrollTo({top:0})}}var ue=(0,V.createContext)({fullPageNavigationOnShallowFalseUpdates:!1});function de(e){let{fullPageNavigationOnShallowFalseUpdates:t}=(0,V.useContext)(ue),[n,r]=(0,V.useState)(()=>typeof location>`u`?new URLSearchParams:oe(new URLSearchParams(location.search),e,!1));return(0,V.useEffect)(()=>{let t=()=>{r(ae(new URLSearchParams(location.search),e,!1))},n=t=>{r(ae(t,e,!0))};return ce.on(`update`,n),window.addEventListener(`popstate`,t),()=>{ce.off(`update`,n),window.removeEventListener(`popstate`,t)}},[e.join(`&`)]),{searchParams:n,updateUrl:(0,V.useMemo)(()=>le(t),[t])}}var fe=d(de);function pe({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return(0,V.createElement)(ue.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,V.createElement)(fe,{...n,children:e}))}var me=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},he={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ge=new class{#e=he;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function _e(e){setTimeout(e,0)}var ve=typeof window>`u`||`Deno`in globalThis;function ye(){}function be(e,t){return typeof e==`function`?e(t):e}function xe(e){return typeof e==`number`&&e>=0&&e!==1/0}function Se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ce(e,t){return typeof e==`function`?e(t):e}function we(e,t){return typeof e==`function`?e(t):e}function Te(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==De(o,t.options))return!1}else if(!ke(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Oe(t.options.mutationKey)!==Oe(a))return!1}else if(!ke(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function De(e,t){return(t?.queryKeyHashFn||Oe)(e)}function Oe(e){return JSON.stringify(e,(e,t)=>Pe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ke(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>ke(e[n],t[n])):!1}var Ae=Object.prototype.hasOwnProperty;function je(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ne(e)&&Ne(t);if(!r&&!(Pe(e)&&Pe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{ge.setTimeout(t,e)})}function Le(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:je(e,t)}function Re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ze(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Be=Symbol();function Ve(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Be?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function He(e,t){return typeof e==`function`?e(...t):!!e}function Ue(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var We=new class extends me{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!ve&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function Ge(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Ke=_e;function qe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ke,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Je=qe(),Ye=new class extends me{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!ve&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xe(e){return Math.min(1e3*2**e,3e4)}function Ze(e){return(e??`online`)===`online`?Ye.isOnline():!0}var Qe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $e(e){let t=!1,n=0,r,i=Ge(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>We.isFocused()&&(e.networkMode===`always`||Ye.isOnline())&&e.canRun(),u=()=>Ze(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ve?0:3),o=e.retryDelay??Xe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var et=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xe(this.gcTime)&&(this.#e=ge.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ve?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(ge.clearTimeout(this.#e),void 0)}},tt=class extends et{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=it(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=it(this.options);e.data!==void 0&&(this.setState(rt(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=Le(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(ye).catch(ye):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>we(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Be||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ce(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Se(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=Ve(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=$e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qe&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qe){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...nt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...rt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),Je.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function nt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ze(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function rt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function it(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}function at(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ue(e,()=>t.signal,()=>n=!0)},u=Ve(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ze:Re;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?st:ot,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ot(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ot(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function st(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ct=class extends et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||lt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$e({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),Je.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function lt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ut=class extends me{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ct({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=dt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=dt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=dt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=dt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Je.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ee(t,e))}findAll(e={}){return this.getAll().filter(t=>Ee(e,t))}notify(e){Je.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Je.batch(()=>Promise.all(e.map(e=>e.continue().catch(ye))))}};function dt(e){return e.options.scope?.id}var ft=class extends me{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??De(r,t),a=this.get(i);return a||(a=new tt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Je.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Te(e,t)):t}notify(e){Je.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Je.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Je.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ft,this.#t=e.mutationCache||new ut,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=We.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ye.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ce(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=be(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Je.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Je.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Je.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Je.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ye).catch(ye)}invalidateQueries(e,t={}){return Je.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Je.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(ye)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ye)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ce(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ye).catch(ye)}fetchInfiniteQuery(e){return e.behavior=at(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ye).catch(ye)}ensureInfiniteQueryData(e){return e.behavior=at(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ye.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Oe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ke(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Oe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ke(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=De(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Be&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},U=i(),mt=V.createContext(void 0),ht=e=>{let t=V.useContext(mt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},gt=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,U.jsx)(mt.Provider,{value:e,children:t})),_t=(0,V.createContext)({live:!1});function vt(){return(0,V.useContext)(_t)}function yt(e){let t=(0,H.c)(5),{children:n}=e,[r]=p(`features`,l),i;t[0]===r?i=t[1]:(i=()=>({live:new Set((r??``).split(`,`).map(bt).filter(Boolean)).has(`live`)}),t[0]=r,t[1]=i);let[a]=(0,V.useState)(i),o;return t[2]!==n||t[3]!==a?(o=(0,U.jsx)(_t.Provider,{value:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function bt(e){return e.trim().toLowerCase()}function xt(e){return S({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 St(e){return S({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 Ct(e){return S({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 wt(e){return S({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`9`,cy:`7`,r:`4`},child:[]},{tag:`path`,attr:{d:`M22 21v-2a4 4 0 0 0-3-3.87`},child:[]},{tag:`path`,attr:{d:`M16 3.13a4 4 0 0 1 0 7.75`},child:[]}]})(e)}function Tt(e){return S({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)}function Et(e){return S({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 Dt(e){return S({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 Ot(e){return S({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 kt(e){return S({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 At(e){return S({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 jt(e){return S({tag:`svg`,attr:{viewBox:`0 0 576 512`},child:[{tag:`path`,attr:{d:`M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z`},child:[]}]})(e)}function Mt(e){return S({tag:`svg`,attr:{viewBox:`0 0 512 512`},child:[{tag:`path`,attr:{d:`M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z`},child:[]}]})(e)}function Nt(e){return S({tag:`svg`,attr:{viewBox:`0 0 288 512`},child:[{tag:`path`,attr:{d:`M112 316.94v156.69l22.02 33.02c4.75 7.12 15.22 7.12 19.97 0L176 473.63V316.94c-10.39 1.92-21.06 3.06-32 3.06s-21.61-1.14-32-3.06zM144 0C64.47 0 0 64.47 0 144s64.47 144 144 144 144-64.47 144-144S223.53 0 144 0zm0 76c-37.5 0-68 30.5-68 68 0 6.62-5.38 12-12 12s-12-5.38-12-12c0-50.73 41.28-92 92-92 6.62 0 12 5.38 12 12s-5.38 12-12 12z`},child:[]}]})(e)}var Pt={Root:`_Root_skwdy_1 _IconButton_1ypaz_23 _LabelledButton_1ypaz_68`,ClipboardCheck:`_ClipboardCheck_skwdy_11`,showClipboardCheck:`_showClipboardCheck_skwdy_1`,MapPin:`_MapPin_skwdy_21`,ButtonLabel:`_ButtonLabel_skwdy_25 _ButtonLabel_1ypaz_244`};function Ft({position:e,quaternion:t}){let n=e=>parseFloat(e.toFixed(3));return`#c${`${n(e.x)},${n(e.y)},${n(e.z)}`}~${`${n(t.x)},${n(t.y)},${n(t.z)},${n(t.w)}`}`}function It(e){let t=(0,H.c)(12),{cameraRef:n,missionName:r,missionType:i,disabled:a}=e,{fogEnabled:o}=c(),[s,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d;t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==i?(d=async()=>{clearTimeout(u.current);let e=n.current;if(!e)return;let t=Ft(e),a=new URLSearchParams;a.set(`mission`,`${r}~${i}`),a.set(`fog`,o.toString());let s=`${window.location.pathname}?${a}${t}`,c=`${window.location.origin}${s}`;window.history.replaceState(null,``,s);try{await navigator.clipboard.writeText(c),l(!0),u.current=setTimeout(()=>{l(!1)},1100)}catch(e){let t=e;console.error(t)}},t[0]=n,t[1]=o,t[2]=r,t[3]=i,t[4]=d):d=t[4];let f=d,p=s?`true`:`false`,m,h,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(Nt,{className:Pt.MapPin}),h=(0,U.jsx)(Ct,{className:Pt.ClipboardCheck}),g=(0,U.jsx)(`span`,{className:Pt.ButtonLabel,children:` Link to coordinates`}),t[5]=m,t[6]=h,t[7]=g):(m=t[5],h=t[6],g=t[7]);let _;return t[8]!==a||t[9]!==f||t[10]!==p?(_=(0,U.jsxs)(`button`,{type:`button`,className:Pt.Root,"aria-label":`Link to coordinates`,title:`Copy the current coordinates to URL`,onClick:f,disabled:a,"data-copied":p,id:`copyCoordinatesButton`,children:[m,h,g]}),t[8]=a,t[9]=f,t[10]=p,t[11]=_):_=t[11],_}function Lt(e){return S({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 Rt=D(`relayClient`),zt=class{ws=null;handlers;url;_connected=!1;wsPingInterval=null;smoothedWsPing=0;constructor(e,t){this.url=e,this.handlers=t}get connected(){return this._connected}connect(){this.ws=new WebSocket(this.url),this.ws.binaryType=`arraybuffer`,this.ws.onopen=()=>{Rt.info(`WebSocket connected to %s`,this.url),this._connected=!0,this.startWsPing(),this.handlers.onOpen?.()},this.ws.onmessage=e=>{if(e.data instanceof ArrayBuffer)this.handlers.onGamePacket?.(new Uint8Array(e.data));else try{let t=JSON.parse(e.data);this.handleMessage(t)}catch(e){Rt.error(`Failed to parse relay message: %o`,e)}},this.ws.onclose=()=>{Rt.info(`WebSocket disconnected`),this._connected=!1,this.stopWsPing(),this.handlers.onClose?.()},this.ws.onerror=()=>{Rt.error(`WebSocket error`),this.handlers.onError?.(`WebSocket connection error`)}}handleMessage(e){switch(e.type){case`serverList`:this.handlers.onServerList?.(e.servers);break;case`status`:this.handlers.onStatus?.(e.status,e.message,e.connectSequence,e.mapName);break;case`ping`:this.handlers.onPing?.(e.ms);break;case`wsPong`:{let t=Date.now()-e.ts;this.smoothedWsPing=this.smoothedWsPing===0?t:this.smoothedWsPing*.5+t*.5,this.handlers.onWsPing?.(Math.round(this.smoothedWsPing));break}case`error`:this.handlers.onError?.(e.message);break}}listServers(){this.send({type:`listServers`})}sendWsPing(){this.send({type:`wsPing`,ts:Date.now()})}joinServer(e,t){Rt.info(`Joining server: %s`,e),this.send({type:`joinServer`,address:e,warriorName:t})}sendAuthEvent(e,t){this.send({type:`sendCommand`,command:e,args:t})}sendCommand(e,t){this.send({type:`sendCommand`,command:e,args:t})}sendCRCResponse(e,t,n){this.send({type:`sendCRCResponse`,crcValue:e,field1:t,field2:n})}sendCRCCompute(e,t,n,r){this.send({type:`sendCRCCompute`,seed:e,field2:t,includeTextures:r,datablocks:n})}sendGhostAck(e,t){this.send({type:`sendGhostAck`,sequence:e,ghostCount:t})}sendMoves(e,t){this.send({type:`sendMoves`,moves:e,moveStartIndex:t})}close(){this.stopWsPing(),this.ws&&=(this.ws.close(),null),this._connected=!1}startWsPing(){this.smoothedWsPing=0,this.send({type:`wsPing`,ts:Date.now()}),this.wsPingInterval=setInterval(()=>{this.send({type:`wsPing`,ts:Date.now()})},7e3)}stopWsPing(){this.wsPingInterval!=null&&(clearInterval(this.wsPingInterval),this.wsPingInterval=null)}send(e){this.ws?.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):Rt.warn(`send dropped (ws not open): %s`,e.type)}},Bt={},Vt=(function(e,t,n,r,i){var a=new Worker(Bt[t]||(Bt[t]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}),Ht=Uint8Array,Ut=Uint16Array,Wt=Int32Array,Gt=new Ht([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Kt=new Ht([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qt=new Ht([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jt=function(e,t){for(var n=new Ut(31),r=0;r<31;++r)n[r]=t+=1<>1|(tn&21845)<<1;nn=(nn&52428)>>2|(nn&13107)<<2,nn=(nn&61680)>>4|(nn&3855)<<4,en[tn]=((nn&65280)>>8|(nn&255)<<8)>>1}for(var rn=(function(e,t,n){for(var r=e.length,i=0,a=new Ut(t);i>c]=l}else for(s=new Ut(r),i=0;i>15-e[i]);return s}),an=new Ht(288),tn=0;tn<144;++tn)an[tn]=8;for(var tn=144;tn<256;++tn)an[tn]=9;for(var tn=256;tn<280;++tn)an[tn]=7;for(var tn=280;tn<288;++tn)an[tn]=8;for(var on=new Ht(32),tn=0;tn<32;++tn)on[tn]=5;rn(an,9,0);var sn=rn(an,9,1);rn(on,5,0);var cn=rn(on,5,1),ln=function(e){for(var t=e[0],n=1;nt&&(t=e[n]);return t},un=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},dn=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},fn=function(e){return(e+7)/8|0},pn=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ht(e.subarray(t,n))},mn=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],hn=function(e,t,n){var r=Error(t||mn[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,hn),!n)throw r;return r},gn=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Ht(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Ht(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Ht(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=un(e,d,1);var v=un(e,d+1,3);if(d+=3,!v){var y=fn(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&hn(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=sn,m=cn,h=9,g=5;else if(v==2){var S=un(e,d,31)+257,C=un(e,d+10,15)+4,w=S+un(e,d+5,31)+1;d+=14;for(var T=new Ht(w),E=new Ht(19),D=0;D>4;if(y<16)T[D++]=y;else{var M=0,ee=0;for(y==16?(ee=3+un(e,d,3),d+=2,M=T[D-1]):y==17?(ee=3+un(e,d,7),d+=3):y==18&&(ee=11+un(e,d,127),d+=7);ee--;)T[D++]=M}}var N=T.subarray(0,S),P=T.subarray(S);h=ln(N),g=ln(P),p=rn(N,h,1),m=rn(P,g,1)}else hn(1);if(d>_){c&&hn(0);break}}s&&l(f+131072);for(var F=(1<>4;if(d+=M&15,d>_){c&&hn(0);break}if(M||hn(2),ne<256)n[f++]=ne;else if(ne==256){I=d,p=null;break}else{var L=ne-254;if(ne>264){var D=ne-257,R=Gt[D];L=un(e,d,(1<>4;re||hn(3),d+=re&15;var P=$t[z];if(z>3){var R=Kt[z];P+=dn(e,d)&(1<_){c&&hn(0);break}s&&l(f+131072);var B=f+L;if(f{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),jn=t(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=An(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),Mn=e(t(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t={}.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=jn()(e);var{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}}))(),1),Nn=[0,0,0,0,0,0,0,0,0,329,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2809,68,0,27,0,58,3,62,4,7,0,0,15,65,554,3,394,404,189,117,30,51,27,15,34,32,80,1,142,3,142,39,0,144,125,44,122,275,70,135,61,127,8,12,113,246,122,36,185,1,149,309,335,12,11,14,54,151,0,0,2,0,0,211,0,2090,344,736,993,2872,701,605,646,1552,328,305,1240,735,1533,1713,562,3,1775,1149,1469,979,407,553,59,279,31,0,0,0,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Pn=1;function Fn(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function In(e){return e.node?e.node.pop:e.leaf.pop}var Ln=new class{nodes=[];leaves=[];tablesBuilt=!1;buildTables(){if(this.tablesBuilt)return;this.tablesBuilt=!0,this.leaves=[];for(let e=0;e<256;e++)this.leaves.push({pop:Nn[e]+(Fn(e)?Pn:0)+Pn,symbol:e,numBits:0,code:0});this.nodes=[{pop:0,index0:0,index1:0}];let e=256,t=[];for(let e=0;e<256;e++)t.push({node:null,leaf:this.leaves[e]});for(;e!==1;){let n=4294967294,r=4294967295,i=-1,a=-1;for(let o=0;oa?i:a;t[s]={node:o,leaf:null},c!==e-1&&(t[c]=t[e-1]),e--}this.nodes[0]=t[0].node,this.generateCodes(0,0,0)}determineIndex(e){return e.leaf===null?this.nodes.indexOf(e.node):-(this.leaves.indexOf(e.leaf)+1)}generateCodes(e,t,n){if(t<0){let r=this.leaves[-(t+1)];r.code=e,r.numBits=n}else{let r=this.nodes[t];this.generateCodes(e,r.index0,n+1),this.generateCodes(e|1<=0)t=e.readFlag()?this.nodes[t].index1:this.nodes[t].index0;else{n.push(this.leaves[-(t+1)].symbol);break}}return String.fromCharCode(...n)}else{let t=e.readInt(8),n=e.readBytes(t);return String.fromCharCode(...n)}}},Rn=class e{data;bitNum;maxReadBitNum;error;stringBuffer=null;constructor(e,t=0){this.data=e,this.bitNum=t,this.maxReadBitNum=e.length<<3,this.error=!1}getCurPos(){return this.bitNum}setCurPos(e){this.bitNum=e}getBytePosition(){return this.bitNum+7>>3}isError(){return this.error}isFull(){return this.bitNum>this.maxReadBitNum}getRemainingBits(){return this.maxReadBitNum-this.bitNum}getMaxPos(){return this.maxReadBitNum}readFlag(){if(this.bitNum>=this.maxReadBitNum)return this.error=!0,!1;let e=1<<(this.bitNum&7),t=(this.data[this.bitNum>>3]&e)!==0;return this.bitNum++,t}readInt(e){if(e===0)return 0;if(this.bitNum+e>this.maxReadBitNum)return this.error=!0,0;let t=this.bitNum>>3,n=this.bitNum&7;if(this.bitNum+=e,e+n<=32){let r=0,i=e+n+7>>3;for(let e=0;e>>=n,e===32?r>>>0:r&(1<>3;for(let e=0;e>>0:r&(1<>3,n=new Uint8Array(t),r=this.bitNum>>3,i=this.bitNum&7,a=8-i;if(i===0)n.set(this.data.subarray(r,r+t));else{let e=this.data[r];for(let o=0;o>i|t<this.maxReadBitNum)return this.error=!0,0;let t=this.bitNum>>3,n=this.bitNum&7,r=e.f32U8;if(n===0)r[0]=this.data[t],r[1]=this.data[t+1],r[2]=this.data[t+2],r[3]=this.data[t+3];else{let e=8-n;for(let i=0;i<4;i++){let a=this.data[t+i],o=t+i+1>n|o<>>0)}getCompressionPoint(){return this.compressionPoint}getDataBlockDataMap(){return this.dataBlockDataMap}getConnectionContext(){let e=this.dataBlockDataMap;return{compressionPoint:this.compressionPoint,ghostTracker:this.ghostTracker,getDataBlockParser:e=>this.registry.getDataBlockParser(e),getDataBlockData:e?t=>e.get(t):void 0,getGhostParser:e=>this.registry.getGhostParser(e)}}_setNextRecvEventSeq(e){this.nextRecvEventSeq=e>>>0}setConnectionProtocolState(e){for(this.lastSeqRecvdAtSend=e.lastSeqRecvdAtSend.slice(0,32);this.lastSeqRecvdAtSend.length<32;)this.lastSeqRecvdAtSend.push(0);this.lastSeqRecvd=e.lastSeqRecvd>>>0,this.highestAckedSeq=e.highestAckedSeq>>>0,this.lastSendSeq=e.lastSendSeq>>>0,this.recvAckMask=e.ackMask>>>0,this.connectSequence=e.connectSequence>>>0,this.lastRecvAckAck=e.lastRecvAckAck>>>0,this._connectionEstablished=e.connectionEstablished}onSendPacketTrigger(){this.lastSendSeq=this.lastSendSeq+1>>>0,this.lastSeqRecvdAtSend[this.lastSendSeq&31]=this.lastSeqRecvd>>>0}applyProtocolHeader(e){if(e.connectSeqBit!==(this.connectSequence&1)||e.ackByteCount>4||e.packetType>2)return{accepted:!1,dispatchData:!1};let t=(e.seqNumber|this.lastSeqRecvd&4294966784)>>>0;if(t>>0),this.lastSeqRecvd+31>>0;if(n>>0),this.lastSendSeq>>0,e.packetType===0&&(this.recvAckMask=(this.recvAckMask|1)>>>0);for(let t=this.highestAckedSeq+1;t<=n;t++)e.ackMask&1<<(n-t&31)&&(this.lastRecvAckAck=this.lastSeqRecvdAtSend[t&31]>>>0);t-this.lastRecvAckAck>32&&(this.lastRecvAckAck=t-32),this.highestAckedSeq=n;let i=this.lastSeqRecvd!==t&&e.packetType===0;return this.lastSeqRecvd=t,{accepted:!0,dispatchData:i}}parsePacket(e){let t=new Rn(e),n=this.readDnetHeader(t),r=this.applyProtocolHeader(n);if(this.packetsParsed++,!r.accepted)return this.protocolRejected++,{dnetHeader:n,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};if(!r.dispatchData)return this.protocolNoDispatch++,{dnetHeader:n,rateInfo:{},gameState:this.emptyGameState(),events:[],ghosts:[]};let i=this.readRateInfo(t);t.setStringBuffer(!0);let a=this.readGameState(t),o=a.controlObjectDataStart===void 0||a.controlObjectData!==void 0,s=o?this.readEvents(t):[],c=s[s.length-1],l=!c||c.dataBitsEnd!==c.dataBitsStart,u=o&&l?t.getCurPos():void 0,d=o&&l?this.readGhosts(t,n.seqNumber):[];return t.setStringBuffer(!1),{dnetHeader:n,rateInfo:i,gameState:a,events:s,ghosts:d,ghostSectionStart:u}}readDnetHeader(e){let t=e.readFlag(),n=e.readInt(1),r=e.readInt(9),i=e.readInt(9),a=e.readInt(2),o=e.readInt(3);return{gameFlag:t,connectSeqBit:n,seqNumber:r,highestAck:i,packetType:a,ackByteCount:o,ackMask:o>0?e.readInt(8*o):0}}readRateInfo(e){let t={};return e.readFlag()&&(t.updateDelay=e.readInt(10),t.packetSize=e.readInt(10)),e.readFlag()&&(t.maxUpdateDelay=e.readInt(10),t.maxPacketSize=e.readInt(10)),t}readGameState(e){let t=e.readInt(32),n,r;e.readFlag()&&(e.readFlag()&&(n=e.readFloat(7)),e.readFlag()&&(r=e.readFloat(7)*1.5));let i,a;e.readFlag()&&(i=e.readFlag(),a=e.readFlag());let o,s,c,l,u;e.readFlag()&&(o=e.readFlag(),o&&(s={x:e.readF32(),y:e.readF32(),z:e.readF32()}),c=e.readRangedU32(0,2),c===1?e.readFlag()&&(l=e.readRangedU32(0,zn-1)):c===2&&(u={x:e.readF32(),y:e.readF32(),z:e.readF32()}));let d=e.readFlag(),f=e.readFlag(),p,m,h,g,_;if(e.readFlag())if(e.readFlag()){let v=e.readInt(10);p=v,m=e.getCurPos();let y=e.savePos(),b=this.ghostTracker.getGhost(v),x=b?this.registry.getGhostParser(b.classId):void 0,S=this.controlParserByGhostIndex.get(v),C=this.registry.getGhostParser(25),w=this.registry.getGhostParser(4),T=[],E=new Set,D=e=>{e?.readPacketData&&(E.has(e.name)||(E.add(e.name),T.push(e)))};D(x),D(S),D(C),D(w);let O=!1;for(let t of T){e.restorePos(y);try{let n=this.getConnectionContext(),r=t.readPacketData(e,n);if(e.getCurPos()-m<=0||e.isError())continue;g=r,h=e.getCurPos(),this.controlParserByGhostIndex.set(v,t),n.compressionPoint!==this.compressionPoint&&(this.compressionPoint=n.compressionPoint,_=this.compressionPoint),this.controlObjectParsed++,O=!0;break}catch{}}if(!O)return e.restorePos(y),h=m,this.controlObjectFailed++,{lastMoveAck:t,damageFlash:n,whiteOut:r,selfLocked:i,selfHomed:a,seekerTracking:o,seekerTrackingPos:s,seekerMode:c,seekerObjectGhostIndex:l,targetPos:u,pinged:d,jammed:f,controlObjectGhostIndex:p,controlObjectDataStart:m,controlObjectDataEnd:h,controlObjectData:g,targetVisibility:[]}}else _={x:e.readF32(),y:e.readF32(),z:e.readF32()},this.compressionPoint=_;let v=[];for(;e.readFlag();)v.push({index:e.readInt(4),mask:e.readInt(32)});let y;return e.readFlag()&&(y=e.readInt(8)),{lastMoveAck:t,damageFlash:n,whiteOut:r,selfLocked:i,selfHomed:a,seekerTracking:o,seekerTrackingPos:s,seekerMode:c,seekerObjectGhostIndex:l,targetPos:u,pinged:d,jammed:f,controlObjectGhostIndex:p,controlObjectDataStart:m,controlObjectDataEnd:h,controlObjectData:g,compressionPoint:_,targetVisibility:v.length>0?v:void 0,cameraFov:y}}readEvents(e){let t=[],n=!0,r=-2;for(;;){let i=e.readFlag();if(n&&!i){if(n=!1,!e.readFlag()){this.dispatchGuaranteedEvents(t);break}}else if(!n&&!i){this.dispatchGuaranteedEvents(t);break}else if(!i)break;let a,o;n||(a=e.readFlag()?r+1&127:e.readInt(7),r=a,o=a|this.nextRecvEventSeq&4294967168,o0&&this.pendingGuaranteedEvents[0].absoluteSequenceNumber===this.nextRecvEventSeq;){let t=this.pendingGuaranteedEvents.shift();if(!t)break;this.nextRecvEventSeq=this.nextRecvEventSeq+1>>>0,e.push(t.event),t.event.parsedData&&this.applyEventSideEffects(t.event.parsedData)}}applyEventSideEffects(e){let t=e.type;if(t===`GhostingMessageEvent`){let t=e.message;typeof t==`number`&&t===2&&this.ghostTracker.clear();return}if(t===`GhostAlwaysObjectEvent`){let t=e.ghostIndex,n=e.classId;if(typeof t==`number`&&typeof n==`number`){let e=this.registry.getGhostParser(n);this.ghostTracker.createGhost(t,n,e?.name??`unknown_${n}`)}}t===`SimDataBlockEvent`&&this.dataBlockDataMap&&e.dataBlockData&&typeof e.objectId==`number`&&this.dataBlockDataMap.set(e.objectId,e.dataBlockData)}readGhosts(e,t){let n=[];if(!e.readFlag())return n;let r=e.readInt(3)+3;for(;e.readFlag()&&!e.isError();){let i=e.readInt(r);if(e.isError())break;if(e.readFlag()){this.ghostTracker.deleteGhost(i),this.ghostDeletes++,n.push({index:i,type:`delete`,updateBitsStart:e.getCurPos(),updateBitsEnd:e.getCurPos()});continue}let a=!this.ghostTracker.hasGhost(i),o;o=a?e.readInt(7)+0:this.ghostTracker.getGhost(i)?.classId;let s=e.getCurPos(),c=o===void 0?void 0:this.registry.getGhostParser(o);if(a&&!c)return this.ghostsTrackerDiverged++,Un(`DIVERGED pkt=%d seq=%d idx=%d classId=%d bit=%d/%d trackerSize=%d (server sent UPDATE for ghost not in our tracker; 7-bit classId is actually update data)`,this.packetsParsed,t,i,o,s,e.getMaxPos(),this.ghostTracker.size()),n.push({index:i,type:`create`,classId:o,updateBitsStart:s,updateBitsEnd:s}),n;let l=!1;if(c)try{let t=this.getConnectionContext();t.currentGhostIndex=i;let r=c.unpackUpdate(e,a,t),u=e.getCurPos();a&&o!==void 0?(this.ghostTracker.createGhost(i,o,c.name),this.ghostCreatesParsed++):this.ghostUpdatesParsed++,n.push({index:i,type:a?`create`:`update`,classId:o,updateBitsStart:s,updateBitsEnd:u,parsedData:r}),l=!0}catch(r){this.ghostsFailed++;let l=a?`create`:`update`,u=r instanceof Error?r.message:String(r);Un(`FAIL pkt=%d seq=%d #%d idx=%d op=%s classId=%d parser=%s bit=%d/%d trackerSize=%d err=%s`,this.packetsParsed,t,n.length,i,l,o,c.name,s,e.getMaxPos(),this.ghostTracker.size(),u)}if(!l)return Un(`STOP pkt=%d seq=%d idx=%d op=%s classId=%d parser=%s bit=%d/%d`,this.packetsParsed,t,i,a?`create`:`update`,o,c?.name??`NONE`,s,e.getMaxPos()),n.push({index:i,type:a?`create`:`update`,classId:o,updateBitsStart:s,updateBitsEnd:s}),n}return n}emptyGameState(){return{lastMoveAck:0,pinged:!1,jammed:!1}}},Gn=class{eventParsers=new Map;ghostParsers=new Map;dataBlockParsers=new Map;eventCatalog=new Map;ghostCatalog=new Map;dataBlockCatalog=new Map;catalogEvent(e){this.eventCatalog.set(e.name,e)}catalogGhost(e){this.ghostCatalog.set(e.name,e)}catalogDataBlock(e){this.dataBlockCatalog.set(e.name,e)}bindDeterministicDataBlocks(e,t){let n=0,r=[];for(let i=0;i0&&(r.sounds=t)}if(e.readFlag()){let t=[];for(let n=0;n<4;n++)e.readFlag()&&t.push({index:n,sequence:e.readInt(5),state:e.readInt(2),forward:e.readFlag(),atEnd:e.readFlag()});t.length>0&&(r.threads=t)}let i=!1;if(e.readFlag()){let n=[];for(let r=0;r<8;r++)if(e.readFlag()){let a={index:r};e.readFlag()?a.dataBlockId=Yn(e):a.dataBlockId=0,e.readFlag()&&(e.readFlag()?(a.skinTagIndex=e.readInt(10),i=!0):(a.skinName=e.readString(),i=!0)),a.triggerDown=e.readFlag(),a.loaded=e.readFlag(),a.ammo=e.readFlag(),a.wet=e.readFlag(),a.target=e.readFlag(),a.fireCount=e.readInt(3),t&&(a.imageExtraFlag=e.readFlag()),n.push(a)}n.length>0&&(r.images=n)}if(e.readFlag()){if(e.readFlag()){r.stateAEnabled=e.readFlag(),r.stateB=e.readFlag();let t=e.readFlag();r.hasInvulnerability=t,t?(r.invulnerabilityVisual=e.readFlag(),r.invulnerabilityTicks=e.readU32()):r.binaryCloak=e.readFlag()}if(e.readFlag())if(e.readFlag()){let t=e.readFlag();r.stateBMode=t,t?r.energyPackOn=!0:r.energyPackOn=!1}else r.shieldNormal=e.readNormalVector(8),r.energyPercent=e.readFloat(5);e.readFlag()&&(r.stateValue1=e.readU32(),r.stateValue2=e.readU32())}return i&&(r.imageSkinDirty=!0),e.readFlag()&&(e.readFlag()?(r.mountObject=e.readInt(10),r.mountNode=e.readInt(5)):r.mountObject=-1),r}function Qn(e,t,n){let r=Zn(e,t,n);if(e.readFlag()&&(r.impactSound=e.readInt(3)),e.readFlag()&&(r.action=e.readInt(8),r.actionHoldAtEnd=e.readFlag(),r.actionAtEnd=e.readFlag(),r.actionFirstPerson=e.readFlag(),r.actionAtEnd||e.readFlag()&&(r.actionAnimPos=e.readSignedFloat(6))),e.readFlag()&&(r.armAction=e.readInt(8)),e.readFlag())return r;if(e.readFlag()){if(r.actionState=e.readInt(3),e.readFlag()&&(r.recoverTicks=e.readInt(7)),r.moveFlag0=e.readFlag(),r.moveFlag1=e.readFlag(),r.position=e.readCompressedPoint(n.compressionPoint),e.readFlag()){let t=e.readInt(13)/32,n=e.readNormalVector(10);r.velocity={x:n.x*t,y:n.y*t,z:n.z*t}}else r.velocity={x:0,y:0,z:0};r.headX=e.readSignedFloat(6),r.headZ=e.readSignedFloat(6),r.rotationZ=e.readFloat(7)*2*Math.PI,r.move=qn(e),r.allowWarp=e.readFlag()}return r.energy=e.readFloat(5),r}function $n(e,t){let n={};if(n.energyLevel=e.readF32(),n.rechargeRate=e.readF32(),n.actionState=e.readInt(3),e.readFlag()&&(n.recoverTicks=e.readInt(7)),e.readFlag()&&(n.jumpDelay=e.readInt(7)),e.readFlag()){let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};n.position=r,t.compressionPoint=r,n.velocity={x:e.readF32(),y:e.readF32(),z:e.readF32()},n.jumpSurfaceLastContact=e.readInt(4)}if(n.headX=e.readF32(),n.headZ=e.readF32(),n.rotationZ=e.readF32(),e.readFlag()){let r=e.readInt(10);n.controlObjectGhost=r;let i=t.ghostTracker.getGhost(r),a=i?t.getGhostParser?.(i.classId):void 0;if(a?.readPacketData){let i=t.currentGhostIndex;t.currentGhostIndex=r,n.controlObjectData=a.readPacketData(e,t),t.currentGhostIndex=i}}return n.disableMove=e.readFlag(),n.pilot=e.readFlag(),n}function er(e,t,n){let r=Zn(e,t,n);return r.jetting=e.readFlag(),e.readFlag()?(r._controlledEarlyReturn=!0,r):(r.steeringYaw=e.readFloat(9),r.steeringPitch=e.readFloat(9),r.move=qn(e),r.frozen=e.readFlag(),e.readFlag()&&(r.position=e.readCompressedPoint(n.compressionPoint),r.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},r.linMomentum=e.readPoint3F(),r.angMomentum=e.readPoint3F()),e.readFlag()&&(r.energy=e.readFloat(8)),r)}function tr(e,t){let n={};n.energyLevel=e.readF32(),n.rechargeRate=e.readF32(),n.steering={x:e.readF32(),y:e.readF32()};let r={x:e.readF32(),y:e.readF32(),z:e.readF32()};return n.linPosition=r,n.angPosition={x:e.readF32(),y:e.readF32(),z:e.readF32(),w:e.readF32()},n.linMomentum=e.readPoint3F(),n.angMomentum=e.readPoint3F(),n.disableMove=e.readFlag(),n.frozen=e.readFlag(),t.compressionPoint=r,n}function nr(e,t){let n=tr(e,t);n.braking=e.readFlag();let r=4,i=t.currentGhostIndex;if(i!==void 0){let e=Kr.get(i);e!==void 0&&(r=e)}let a=[];for(let t=0;t64)throw Error(`Invalid Sky fogVolumeCount: ${t}`);r.fogVolumeCount=t,r.useSkyTextures=e.readBool(),r.renderBottomTexture=e.readBool(),r.skySolidColor={r:e.readF32(),g:e.readF32(),b:e.readF32()},r.windEffectPrecipitation=e.readBool();let n=[];for(let r=0;r3)throw Error(`Invalid precipitation colorCount: ${t}`);let n=[];for(let r=0;rMath.floor(e.getRemainingBits()/96))throw Error(`Invalid physicalZone point count: ${t}`);let n=[];for(let r=0;rMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone plane count: ${i}`);let a=[];for(let t=0;tMath.floor(e.getRemainingBits()/128))throw Error(`Invalid physicalZone edge count: ${o}`);let s=[];for(let t=0;t0&&(n.audioData=e.readBitsBuffer(r*8)),n}function _i(e,t){return{type:`GhostingMessageEvent`,sequence:e.readU32(),message:e.readInt(3),ghostCount:e.readInt(11)}}function vi(e,t){let n={type:`GhostAlwaysObjectEvent`};n.ghostIndex=e.readInt(10);let r=e.readFlag();if(n._hasObjectData=r,r){let r=e.readInt(7);n.classId=r;let i=t.getGhostParser?.(r);if(!i)throw Error(`No ghost parser for GhostAlwaysObjectEvent classId=${r}`);n.objectData=i.unpackUpdate(e,!0,t)}return n}function yi(e,t){let n={type:`PathManagerEvent`};if(e.readFlag()){n.messageType=`NewPaths`;let t=e.readU32(),r=[];for(let n=0;n0&&(t.hudImages=n),t}function Fi(e){let t={};e.readFlag()&&(t.crc=e.readU32()),t.shapeName=e.readString(),t.mountPoint=e.readU32(),e.readFlag()||(t.offset=e.readAffineTransform()),t.firstPerson=e.readFlag(),t.mass=e.readF32(),t.usesEnergy=e.readFlag(),t.minEnergy=e.readF32(),t.hasFlash=e.readFlag(),t.projectile=W(e),t.muzzleFlash=W(e),t.isSeeker=e.readFlag(),t.isSeeker&&(t.seekerRadius=e.readF32(),t.maxSeekAngle=e.readF32(),t.seekerLockTime=e.readF32(),t.seekerFreeTime=e.readF32(),t.isTargetLockRequired=e.readFlag(),t.maxLockRange=e.readF32()),t.cloakable=e.readFlag(),t.lightType=e.readRangedU32(0,3),t.lightType!==0&&(t.lightRadius=e.readF32(),t.lightTime=e.readS32(),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)}),t.shellExitDir={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.shellExitVariance=e.readF32(),t.shellVelocity=e.readF32(),t.casing=W(e),t.accuFire=e.readFlag();let n=[];for(let t=0;t<31;t++){if(!e.readFlag())continue;let t={};t.name=e.readString(),t.transitionOnAmmo=e.readInt(5),t.transitionOnNoAmmo=e.readInt(5),t.transitionOnTarget=e.readInt(5),t.transitionOnNoTarget=e.readInt(5),t.transitionOnWet=e.readInt(5),t.transitionOnNotWet=e.readInt(5),t.transitionOnTriggerUp=e.readInt(5),t.transitionOnTriggerDown=e.readInt(5),t.transitionOnTimeout=e.readInt(5),t.transitionGeneric0In=e.readInt(5),t.transitionGeneric0Out=e.readInt(5),e.readFlag()&&(t.timeoutValue=e.readF32()),t.waitForTimeout=e.readFlag(),t.fire=e.readFlag(),t.ejectShell=e.readFlag(),t.scaleAnimation=e.readFlag(),t.direction=e.readFlag(),t.reload=e.readFlag(),e.readFlag()&&(t.energyDrain=e.readF32()),t.loaded=e.readInt(3),t.spin=e.readInt(3),t.recoil=e.readInt(3),e.readFlag()&&(t.sequence=e.readSignedInt(16)),e.readFlag()&&(t.sequenceVis=e.readSignedInt(16)),t.flashSequence=e.readFlag(),t.ignoreLoadedForReady=e.readFlag(),t.emitter=W(e),t.emitter!==null&&(t.emitterTime=e.readF32(),t.emitterNode=e.readS32()),t.sound=W(e),n.push(t)}return t.states=n,t}function Ii(e){let t=Pi(e);t.renderFirstPerson=e.readFlag(),t.minLookAngle=e.readF32(),t.maxLookAngle=e.readF32(),t.maxFreelookAngle=e.readF32(),t.maxTimeScale=e.readF32(),t.maxStepHeight=e.readF32(),t.runForce=e.readF32(),t.runEnergyDrain=e.readF32(),t.minRunEnergy=e.readF32(),t.maxForwardSpeed=e.readF32(),t.maxBackwardSpeed=e.readF32(),t.maxSideSpeed=e.readF32(),t.maxUnderwaterForwardSpeed=e.readF32(),t.maxUnderwaterBackwardSpeed=e.readF32(),t.maxUnderwaterSideSpeedRef=W(e),e.readFlag()&&(t.runSurfaceAngleRef=e.readInt(11)),t.runSurfaceAngle=e.readF32(),t.recoverDelay=e.readF32(),t.recoverRunForceScale=e.readF32(),t.jumpForce=e.readF32(),t.jumpEnergyDrain=e.readF32(),t.minJumpEnergy=e.readF32(),t.minJumpSpeed=e.readF32(),t.maxJumpSpeed=e.readF32(),t.jumpSurfaceAngle=e.readF32(),t.minJetEnergy=e.readF32(),t.splashVelocity=e.readF32(),t.splashAngle=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.bubbleEmitTime=e.readF32(),t.medSplashSoundVel=e.readF32(),t.hardSplashSoundVel=e.readF32(),t.exitSplashSoundVel=e.readF32(),t.jumpDelay=e.readInt(7),t.horizMaxSpeed=e.readF32(),t.horizResistSpeed=e.readF32(),t.horizResistFactor=e.readF32(),t.upMaxSpeed=e.readF32(),t.upResistSpeed=e.readF32(),t.upResistFactor=e.readF32(),t.jetEnergyDrain=e.readF32(),t.canJet=e.readF32(),t.maxJetHorizontalPercentage=e.readF32(),t.maxJetForwardSpeed=e.readF32(),t.jetForce=e.readF32(),t.minJetSpeed=e.readF32(),t.maxDamage=e.readF32(),t.minImpactDamageSpeed=e.readF32(),t.impactDamageScale=e.readF32(),t.footSplashHeight=e.readF32();let n=[];for(let t=0;t<32;t++)e.readFlag()?n.push(e.readInt(11)):n.push(null);t.sounds=n,t.boxSize={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.footPuffEmitter=W(e),t.footPuffNumParts=e.readF32(),t.footPuffRadius=e.readF32(),t.decalData=W(e),t.decalOffset=e.readF32(),t.dustEmitter=W(e),t.splash=W(e);let r=[];for(let t=0;t<3;t++)r.push(W(e));return t.splashEmitters=r,t.groundImpactMinSpeed=e.readF32(),t.groundImpactShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.groundImpactShakeDuration=e.readF32(),t.groundImpactShakeFalloff=e.readF32(),t.boundingRadius=e.readF32(),t.moveBubbleSize=e.readF32(),t}function Li(e){let t=Pi(e);t.bodyRestitution=e.readF32(),t.bodyFriction=e.readF32();let n=[];for(let t=0;t<2;t++)n.push(W(e));t.impactSounds=n,t.minImpactSpeed=e.readF32(),t.softImpactSpeed=e.readF32(),t.hardImpactSpeed=e.readF32(),t.minRollSpeed=e.readF32(),t.maxSteeringAngle=e.readF32(),t.maxDrag=e.readF32(),t.minDrag=e.readF32(),t.cameraOffset=e.readF32(),t.cameraLag=e.readF32(),t.jetForce=e.readF32(),t.jetEnergyDrain=e.readF32(),t.minJetEnergy=e.readF32(),t.integration=e.readF32(),t.collisionTol=e.readF32(),t.massCenter=e.readF32(),t.exitSplashSoundVelocity=e.readF32(),t.softSplashSoundVelocity=e.readF32(),t.mediumSplashSoundVelocity=e.readF32(),t.hardSplashSoundVelocity=e.readF32();let r=[];for(let t=0;t<5;t++)r.push(W(e));t.waterSounds=r,t.dustEmitter=W(e);let i=[];for(let t=0;t<3;t++)i.push(W(e));t.damageEmitters=i;let a=[];for(let t=0;t<2;t++)a.push(W(e));return t.splashEmitters=a,t.damageEmitterOffset0={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageEmitterOffset1={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.damageLevelTolerance0=e.readF32(),t.damageLevelTolerance1=e.readF32(),t.splashFreqMod=e.readF32(),t.splashVelEpsilon=e.readF32(),t.collDamageThresholdVel=e.readF32(),t.collDamageMultiplier=e.readF32(),t}function Ri(e){let t=Li(e);t.jetActivateSound=W(e),t.jetDeactivateSound=W(e);let n=[];for(let t=0;t<4;t++)n.push(W(e));return t.jetEmitters=n,t.maneuveringForce=e.readF32(),t.horizontalSurfaceForce=e.readF32(),t.verticalSurfaceForce=e.readF32(),t.autoInputDamping=e.readF32(),t.steeringForce=e.readF32(),t.steeringRollForce=e.readF32(),t.rollForce=e.readF32(),t.autoAngularForce=e.readF32(),t.rotationalDrag=e.readF32(),t.maxAutoSpeed=e.readF32(),t.autoLinearForce=e.readF32(),t.hoverHeight=e.readF32(),t.createHoverHeight=e.readF32(),t.minTrailSpeed=e.readF32(),t.vertThrustMultiple=e.readF32(),t.maxForwardSpeed=e.readF32(),t}function zi(e){let t=Li(e);t.dragForce=e.readF32(),t.mainThrustForce=e.readF32(),t.reverseThrustForce=e.readF32(),t.strafeThrustForce=e.readF32(),t.turboFactor=e.readF32(),t.stabLenMin=e.readF32(),t.stabLenMax=e.readF32(),t.stabSpringConstant=e.readF32(),t.stabDampingConstant=e.readF32(),t.gyroDrag=e.readF32(),t.normalForce=e.readF32(),t.restorativeForce=e.readF32(),t.steeringForce=e.readF32(),t.rollForce=e.readF32(),t.pitchForce=e.readF32(),t.floatingThrustFactor=e.readF32(),t.brakingForce=e.readF32(),t.dustTrailOffset={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.dustTrailFreqMod=e.readF32(),t.triggerTrailHeight=e.readF32(),t.floatSound=W(e),t.thrustSound=W(e),t.turboSound=W(e);let n=[];for(let t=0;t<3;t++)n.push(W(e));return t.jetEmitters=n,t.dustTrailEmitter=W(e),t.mainThrustEmitterFactor=e.readF32(),t.strafeThrustEmitterFactor=e.readF32(),t.reverseThrustEmitterFactor=e.readF32(),t}function Bi(e){let t=Li(e);return t.tireRadius=e.readF32(),t.tireStaticFriction=e.readF32(),t.tireKineticFriction=e.readF32(),t.tireRestitution=e.readF32(),t.tireLateralForce=e.readF32(),t.tireLateralDamping=e.readF32(),t.tireLateralRelaxation=e.readF32(),t.tireLongitudinalForce=e.readF32(),t.tireLongitudinalDamping=e.readF32(),t.tireEmitter=W(e),t.jetSound=W(e),t.engineSound=W(e),t.squealSound=W(e),t.wadeSound=W(e),t.spring=e.readF32(),t.springDamping=e.readF32(),t.springLength=e.readF32(),t.brakeTorque=e.readF32(),t.engineTorque=e.readF32(),t.engineBrake=e.readF32(),t.maxWheelSpeed=e.readF32(),t.steeringAngle=e.readF32(),t.steeringReturn=e.readF32(),t.steeringDamping=e.readF32(),t.powerSteeringFactor=e.readF32(),t}function Vi(e){let t=Pi(e);return t.noIndividualDamage=e.readFlag(),t.dynamicTypeField=e.readS32(),t}function Hi(e){let t=Vi(e);return t.thetaMin=e.readF32(),t.thetaMax=e.readF32(),t.thetaNull=e.readF32(),t.neverUpdateControl=e.readFlag(),t.primaryAxis=e.readRangedU32(0,3),t.maxCapacitorEnergy=e.readF32(),t.capacitorRechargeRate=e.readF32(),t}function Ui(e){let t=Fi(e);return t.activationMS=e.readInt(8),t.deactivateDelayMS=e.readInt(8),t.degPerSecTheta=e.readRangedU32(0,1080),t.degPerSecPhi=e.readRangedU32(0,1080),t.dontFireInsideDamageRadius=e.readFlag(),t.damageRadius=e.readF32(),t.useCapacitor=e.readFlag(),t}function Wi(e){let t=Pi(e);return t.friction=e.readFloat(10),t.elasticity=e.readFloat(10),t.sticky=e.readFlag(),e.readFlag()&&(t.gravityMod=e.readFloat(10)),e.readFlag()&&(t.maxVelocity=e.readF32()),e.readFlag()&&(t.lightType=e.readInt(2),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7),a:e.readFloat(7)},t.lightTime=e.readS32(),t.lightRadius=e.readF32(),t.lightOnlyStatic=e.readFlag()),t}function Gi(e){let t={};t.projectileShapeName=e.readString(),t.faceViewerLinkTime=e.readS32(),t.lifetime=e.readS32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.scale={x:e.readF32(),y:e.readF32(),z:e.readF32()}),t.baseEmitter=W(e),t.delayEmitter=W(e),t.bubbleEmitter=W(e),t.explosion=W(e),t.underwaterExplosion=W(e),t.splash=W(e),t.sound=W(e),t.wetFireSound=W(e),t.fireSound=W(e);let n=[];for(let t=0;t<6;t++)n.push(W(e));return t.decals=n,e.readFlag()&&(t.lightRadius=e.readFloat(8),t.lightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),e.readFlag()&&(t.underwaterLightColor={r:e.readFloat(7),g:e.readFloat(7),b:e.readFloat(7)}),t.explodeOnWaterImpact=Mi(e),t.depthTolerance=e.readF32(),t}function Ki(e){let t=Gi(e);return t.dryVelocity=e.readF32(),t.wetVelocity=e.readF32(),t.fizzleTime=e.readU32(),t.fizzleType=e.readU32(),t.hardRetarget=e.readFlag(),t.inheritedVelocityScale=e.readRangedU32(0,90),t.lifetimeMS=e.readRangedU32(0,90),t.collideWithOwnerTimeMS=e.readU32(),t.proximityRadius=e.readU32(),t.tracerProjectile=e.readFlag(),t}function qi(e){let t=Gi(e);return t.armingDelayMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.grenadeElasticity=e.readF32(),t.grenadeFriction=e.readF32(),t.drag=e.readF32(),t.density=e.readF32(),t.gravityMod=e.readF32(),t.lifetimeMS=e.readS32(),t}function Ji(e){let t=Gi(e);return t.lifetimeMS=e.readS32(),t.muzzleVelocity=e.readF32(),t.turningSpeed=e.readF32(),t.proximityRadius=e.readF32(),t.terrainAvoidanceSpeed=e.readF32(),t.terrainScanAhead=e.readF32(),t.terrainHeightFail=e.readF32(),t.terrainAvoidanceRadius=e.readF32(),t.flareDistance=e.readF32(),t.flareAngle=e.readF32(),t.useFlechette=Mi(e),t.maxVelocity=e.readF32(),t.acceleration=e.readF32(),t.flechetteDelayMs=e.readS32(),t.exhaustTimeMs=e.readS32(),t.exhaustNodeName=e.readString(),t.casingShapeName=e.readString(),t.casingDebris=W(e),t.puffEmitter=W(e),t.exhaustEmitter=W(e),t}function Yi(e){let t=Gi(e);t.maxRifleRange=e.readF32(),t.rifleHeadMultiplier=e.readF32(),t.beamColor=ji(e),t.fadeTime=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32(),t.lightColor=ji(e),t.lightRadius=e.readF32();let n=[];for(let t=0;t<12;t++)n.push(e.readString());return t.textures=n,t}function Xi(e){let t=Gi(e);t.zapDuration=e.readF32(),t.boltLength=e.readF32(),t.numParts=e.readF32(),t.lightningFreq=e.readF32(),t.lightningDensity=e.readF32(),t.lightningAmp=e.readF32(),t.lightningWidth=e.readF32(),t.shockwave=W(e);let n=[],r=[],i=[],a=[];for(let t=0;t<2;t++)n.push(e.readF32()),r.push(e.readF32()),i.push(e.readF32()),a.push(e.readF32());t.startWidth=n,t.endWidth=r,t.boltSpeed=i,t.texWrap=a;let o=[];for(let t=0;t<4;t++)o.push(e.readString());return t.textures=o,t.emitter=W(e),t}function Zi(e){let t=Gi(e);return t.beamRange=e.readF32(),t.beamDrainRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t.flareTexture=e.readString(),t.hitEmitter=W(e),t}function Qi(e){let t=Gi(e);return t.beamRange=e.readF32(),t.beamRepairRate=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=e.readF32(),t.startWidth=e.readF32(),t.endWidth=e.readF32(),t.startBeamWidth=e.readF32(),t.endBeamWidth=e.readF32(),t.mainBeamTexture=e.readString(),t.innerBeamTexture=e.readString(),t}function $i(e){let t=Gi(e);t.maxRifleRange=e.readF32(),t.beamColor=ji(e),t.startBeamWidth=e.readF32(),t.pulseBeamWidth=e.readF32(),t.beamFlareAngle=e.readF32(),t.minFlareSize=e.readF32(),t.maxFlareSize=e.readF32(),t.pulseSpeed=e.readF32(),t.pulseLength=e.readF32();let n=[];for(let t=0;t<4;t++)n.push(e.readString());return t.textures=n,t}function ea(e){let t=Ki(e);return t.tracerLength=e.readF32(),t.tracerAlpha=e.readF32(),t.tracerMinPixels=e.readF32(),t.crossViewFraction=Mi(e),t.tracerColor=ji(e),t.tracerWidth=e.readF32(),t.muzzleVelocity=e.readF32(),t.proximityRadius=Mi(e),t.textureName0=e.readString(),t.textureName1=e.readString(),t}function ta(e){let t=qi(e);return t.energyDrainPerSecond=e.readF32(),t.energyMinDrain=e.readF32(),t.beamWidth=e.readF32(),t.beamRange=e.readF32(),t.numSegments=e.readF32(),t.texRepeat=e.readF32(),t.beamFlareAngle=e.readF32(),t.beamTexture=e.readString(),t.flareTexture=e.readString(),t}function na(e){let t=Ki(e);return t.numFlares=e.readF32(),t.flareColor=ji(e),t.flareTexture=e.readString(),t.smokeTexture=e.readString(),t.size=e.readF32(),t.flareModTexture=e.readF32(),t.smokeSize=e.readF32(),t}function ra(e){let t=qi(e);return t.smokeDist=e.readF32(),t.noSmoke=e.readF32(),t.boomTime=e.readF32(),t.casingDist=e.readF32(),t.smokeCushion=e.readF32(),t.noSmokeCounter=e.readF32(),t.smokeTexture=e.readString(),t.bombTexture=e.readString(),t}function ia(e){let t=qi(e);return t.size=e.readF32(),t.useLensFlare=Mi(e),t.flareTexture=e.readString(),t.lensFlareTexture=e.readString(),t}function aa(e){let t={};t.dtsFileName=e.readString(),t.soundProfile=W(e),t.particleEmitter=W(e),t.particleDensity=e.readInt(14),t.particleRadius=e.readF32(),t.faceViewer=e.readFlag(),e.readFlag()&&(t.explosionScale={x:e.readInt(16),y:e.readInt(16),z:e.readInt(16)}),t.playSpeed=e.readInt(14),t.debrisThetaMin=e.readRangedU32(0,180),t.debrisThetaMax=e.readRangedU32(0,180),t.debrisPhiMin=e.readRangedU32(0,360),t.debrisPhiMax=e.readRangedU32(0,360),t.debrisMinVelocity=e.readRangedU32(0,1e3),t.debrisMaxVelocity=e.readRangedU32(0,1e3),t.debrisNum=e.readInt(14),t.debrisVariance=e.readRangedU32(0,1e4),t.delayMS=e.readInt(16),t.delayVariance=e.readInt(16),t.lifetimeMS=e.readInt(16),t.lifetimeVariance=e.readInt(16),t.offset=e.readF32(),t.shakeCamera=e.readFlag(),t.hasLight=e.readFlag(),t.camShakeFreq={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeAmp={x:e.readF32(),y:e.readF32(),z:e.readF32()},t.camShakeDuration=e.readF32(),t.camShakeRadius=e.readF32(),t.camShakeFalloff=e.readF32(),t.shockwave=W(e),t.debris=W(e);let n=[];for(let t=0;t<4;t++)n.push(W(e));t.emitters=n;let r=[];for(let t=0;t<5;t++)r.push(W(e));t.subExplosions=r;let i=e.readRangedU32(0,4),a=[];for(let t=0;t0&&Ia(`DataBlock binding: %d/%d bound, missing parsers: %s`,t,Bn.length,n.join(`, `));let{bound:r,missing:i}=this.registry.bindDeterministicGhosts(Vn,0);i.length>0&&Ia(`Ghost binding: %d/%d bound, missing parsers: %s`,r,Vn.length,i.join(`, `));let{bound:a,missing:o}=this.registry.bindDeterministicEvents(Hn,255);o.length>0&&Ia(`Event binding: %d/%d bound, missing parsers: %s`,a,Hn.length,o.join(`, `)),this.packetParser=new Wn(this.registry,this.ghostTracker)}getRegistry(){return this.registry}getGhostTracker(){return this.ghostTracker}getPacketParser(){return this.packetParser}get loaded(){return this._loaded}get header(){if(!this._loaded)throw Error(`must call load() first`);return this._header}get initialBlock(){if(!this._loaded)throw Error(`must call load() first`);return this._initialBlock}get blockCount(){if(!this._loaded)throw Error(`must call load() first`);if(this._blockCount===void 0){let e=this._decompressedData,t=this._decompressedView,n=0,r=0;for(;r+2<=e.length;){let i=t.getUint16(r,!0)&4095;if(r+=2+i,r>e.length)break;n++}this._blockCount=n}return this._blockCount}get blockCursor(){if(!this._loaded)throw Error(`must call load() first`);return this._blockCursor}async load(){if(this._loaded)return{header:this._header,initialBlock:this._initialBlock};let e=this.readHeader();Ia(`header: "%s" version=0x%s length=%dms (%smin) initialBlockSize=%d`,e.identString,e.protocolVersion.toString(16),e.demoLengthMs,(e.demoLengthMs/1e3/60).toFixed(1),e.initialBlockSize);let t=this.buffer.subarray(this.offset,this.offset+e.initialBlockSize),n=this.readInitialBlock(t);this.offset+=e.initialBlockSize;let r=this.buffer.subarray(this.offset);Ia(`compressed block stream: %d bytes`,r.length);let i=await new Promise((e,t)=>{Dn(r,(n,r)=>{n?t(n):e(r)})});return Ia(`decompressed block stream: %d bytes`,i.length),this._decompressedData=i,this._decompressedView=new DataView(i.buffer,i.byteOffset,i.byteLength),this.setupPacketParser(n),this._header=e,this._initialBlock=n,this._blockStreamOffset=0,this._blockCursor=0,this._loaded=!0,{header:e,initialBlock:n}}nextBlock(){if(!this._loaded)throw Error(`must call load() first`);let e=this._decompressedData,t=this._decompressedView,n=this._blockStreamOffset;if(n+2>e.length)return;let r=t.getUint16(n,!0),i=r>>12,a=r&4095;if(n+2+a>e.length){Ra(`block %d: size %d would exceed decompressed data (offset=%d remaining=%d), stopping`,this._blockCursor,a,n+2,e.length-n-2);return}let o=e.subarray(n+2,n+2+a);this._blockStreamOffset=n+2+a;let s={index:this._blockCursor,type:i,size:a,data:o};if(this._blockCursor++,i===0)try{s.parsed=this.packetParser.parsePacket(o)}catch{}else if(i===1)this.packetParser.onSendPacketTrigger();else if(i===2&&a===64)try{s.parsed=this.readRawMove(o)}catch{}else if(i===3&&a===8)try{s.parsed=this.readInfoBlock(o)}catch{}return s}reset(){if(!this._loaded)throw Error(`must call load() first`);this._blockStreamOffset=0,this._blockCursor=0,this._blockCount=void 0,this.setupPacketParser(this._initialBlock)}processBlocks(e){if(!this._loaded)throw Error(`must call load() first`);let t=0;for(let n=0;n=128&&n<128+Bn.length?Bn[n-128]:`unknown(${n})`;throw Error(`No parser for DataBlock classId ${n} (${e}) at bit ${c}`)}}Ia(`all %d/%d DataBlocks parsed (%d payloads), bit position after DataBlocks: %d`,o,r,a.size,t.getCurPos());let s=t.readU8()!==0,c=[];for(let e=0;e<6;e++)c.push(t.readU32());let l=[];for(let e=0;e<16;e++)l.push(t.readU32());let u=t.readU32(),d=[];for(let e=0;e>3<<3),this.readSimpleTargetManager(t),this.readSimpleTargetManager(t),La(`after sequential tail bit=%d mission="%s" CRC=0x%s`,t.getCurPos(),k,A.toString(16))}catch(e){j=e instanceof Error?e.message:String(e)}finally{this.ghostTracker=S}let M=b-t.getCurPos(),ee=k.length>0?k.split(``).filter(e=>{let t=e.charCodeAt(0);return t>=32&&t<=126}).length/k.length:1,N=k.length>0&&ee>=.8&&j===void 0;return Ia(`initial block: events=%d ghosts=%d ghostingSeq=%d controlObj=%d mission="%s" CRC=0x%s valid=%s%s`,C.length,E.length,T,D,k,A.toString(16),N,j?` error=${j}`:``),{taggedStrings:n,dataBlockHeaders:i,dataBlockCount:o,dataBlocks:a,firstPerson:s,connectionFields:c,stateArray:l,scoreEntries:d,demoValues:f,sensorGroupColors:p,targetEntries:m,connectionState:h,roundTripTime:g,packetLoss:_,pathManager:v,notifyCount:y,nextRecvEventSeq:w,ghostingSequence:T,initialGhosts:E,initialEvents:C,controlObjectGhostIndex:D,controlObjectData:O,missionName:k,missionCRC:A,phase2TrailingBits:M,phase2Valid:N,phase2Error:j}}readScoreEntry(e){let t=e.readFlag()?e.readInt(16):0,n=e.readFlag()?e.readInt(16):0,r=e.readFlag()?e.readInt(16):0,i=e.readInt(6),a=e.readInt(6),o=e.readInt(6),s=e.readFlag(),c=[];for(let t=0;t<6;t++)c.push(e.readFlag());return{clientId:t,teamId:n,score:r,field0:i,field1:a,field2:o,isBot:s,triggerFlags:c}}readDemoValues(e){let t=[];for(;e.readFlag();)t.push(e.readString());return t}readComplexTargetManager(e){e.readU8(),e.readU8(),e.readU8(),e.readU8();let t=[];for(let n=0;n<32;n++)for(let r=0;r<32;r++)e.readFlag()&&t.push({group:n,targetGroup:r,r:e.readU8(),g:e.readU8(),b:e.readU8(),a:e.readU8()});let n=[];for(let t=0;t<512;t++){if(!e.readFlag())continue;let r={targetId:t,sensorGroup:0,targetData:0,damageLevel:0};e.readFlag()&&(r.sensorData=e.readU32()),e.readFlag()&&(r.voiceMapData=e.readU32()),e.readFlag()&&(r.name=e.readString()),e.readFlag()&&(r.skin=e.readString()),e.readFlag()&&(r.skinPref=e.readString()),e.readFlag()&&(r.voice=e.readString()),e.readFlag()&&(r.typeDescription=e.readString()),r.sensorGroup=e.readInt(5),r.targetData=e.readInt(9),t>=32&&e.readFlag()&&(r.dataBlockRef=e.readInt(11)),r.damageLevel=e.readFloat(7),n.push(r)}return{sensorGroupColors:t,targets:n}}readPathManager(e){let t=[],n=e.readU32();for(let r=0;rthis.registry.getDataBlockParser(e)};a=i.unpack(e,t)}catch{n.push({classId:t,guaranteed:!0,dataBitsStart:r,dataBitsEnd:r});break}else{n.push({classId:t,guaranteed:!0,dataBitsStart:r,dataBitsEnd:r});break}n.push({classId:t,guaranteed:!0,dataBitsStart:r,dataBitsEnd:e.getCurPos(),parsedData:a}),La(` event classId=%d bits=%d`,t,e.getCurPos()-r)}return{nextRecvEventSeq:t,events:n}}readGhostStartBlock(e,t){let n=e.readU32(),r=[];La(`ghost block: seq=%d bit=%d`,n,e.getCurPos());let i=this.registry.getGhostCatalog(),a=e.getBuffer().length*8,o=new Map;for(let[e,n]of t)o.set(e,n.data);for(;e.readFlag()&&!e.isError();){let n=e.readInt(10),s=e.readInt(7)+0,c=e.getCurPos(),l=[],u=new Set,{entry:d}=this.identifyGhostViaDataBlock(e,t,i),f=this.registry.getGhostParser(s);f&&(l.push({entry:f,method:`registry`}),u.add(f)),d&&!u.has(d)&&(l.push({entry:d,method:`datablock`}),u.add(d));let p={getDataBlockData:e=>o.get(e),getDataBlockParser:e=>this.registry.getDataBlockParser(e)},m=!1;for(let{entry:t,method:i}of l){let o=i===`registry`,l=this.tryGhostParser(e,t,c,a,!1,p,o);if(l!==!1){this.ghostTracker.createGhost(n,s,t.name),La(` ghost idx=%d classId=%d parser=%s bits=%d via=%s`,n,s,t.name,e.getCurPos()-c,i),r.push({index:n,type:`create`,classId:s,updateBitsStart:c,updateBitsEnd:e.getCurPos(),parsedData:l}),m=!0;break}}if(!m){La(` ghost idx=%d classId=%d NO PARSER (stopping at bit=%d, remaining=%d)`,n,s,c,a-c);break}}return La(`ghost loop ended at bit=%d remaining=%d count=%d`,e.getCurPos(),a-e.getCurPos(),r.length),{ghostingSequence:n,ghosts:r}}tryGhostParser(e,t,n,r,i=!1,a,o=!1){let s=e.savePos();i||La(` try %s: startBit=%d`,t.name,n);try{let c=t.unpackUpdate(e,!0,{compressionPoint:{x:0,y:0,z:0},ghostTracker:this.ghostTracker,...a}),l=e.getCurPos()-n,u=r-e.getCurPos();if(e.isError()||!o&&l<3)return i||La(` reject %s: bits=%d isError=%s`,t.name,l,e.isError()),e.restorePos(s),!1;if(u>1e3){let n=e.getCurPos(),r=e.readFlag();if(e.setCurPos(n),!r)return i||La(` reject %s: bits=%d misaligned (remaining=%d)`,t.name,l,u),e.restorePos(s),!1}return c??{}}catch(n){return i||La(` reject %s: error at bit=%d: %s`,t.name,e.getCurPos(),n instanceof Error?n.message:String(n)),e.restorePos(s),!1}}identifyGhostViaDataBlock(e,t,n){if(!t)return{entry:void 0,dbFlag:!1};let r=e.savePos(),i,a=!1;try{if(a=e.readFlag(),a){let r=e.readInt(11),a=t.get(r);if(a){let e=a.className.replace(/Data$/,``);i=n.get(e),i||La(` identifyGhostViaDataBlock: dbId=%d className=%s ghostName=%s (no ghost parser)`,r,a.className,e)}else La(` identifyGhostViaDataBlock: dbId=%d (no DataBlock found)`,r)}else La(` identifyGhostViaDataBlock: DataBlock flag=0`)}catch{}return e.restorePos(r),{entry:i,dbFlag:a}}readRawMove(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getInt32(0,!0),r=t.getInt32(4,!0),i=t.getInt32(8,!0),a=t.getUint32(12,!0),o=t.getUint32(16,!0),s=t.getUint32(20,!0),c=t.getFloat32(24,!0),l=t.getFloat32(28,!0),u=t.getFloat32(32,!0),d=t.getFloat32(36,!0),f=t.getFloat32(40,!0),p=t.getFloat32(44,!0),m=t.getUint32(48,!0),h=t.getUint32(52,!0),g=e[56]!==0,_=[];for(let t=0;t<6;t++)_.push(e[57+t]!==0);return{px:n,py:r,pz:i,pyaw:a,ppitch:o,proll:s,x:c,y:l,z:u,yaw:d,pitch:f,roll:p,id:m,sendCount:h,freeLook:g,trigger:_}}readInfoBlock(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{value1:t.getUint32(0,!0),value2:t.getFloat32(4,!0)}}};function Ba(){let e=new Gn,t=new Kn;return ki(e),$r(e),Fa(e),e.bindDeterministicDataBlocks(Bn,128),e.bindDeterministicGhosts(Vn,0),e.bindDeterministicEvents(Hn,255),{registry:e,ghostTracker:t,packetParser:new Wn(e,t,{dataBlockDataMap:new Map})}}var Va=new Set([`FlyingVehicle`,`HoverVehicle`,`WheeledVehicle`]),Ha=new Set([`BombProjectile`,`EnergyProjectile`,`FlareProjectile`,`GrenadeProjectile`,`LinearFlareProjectile`,`LinearProjectile`,`Projectile`,`SeekerProjectile`,`TracerProjectile`]),Ua=new Set([`LinearProjectile`,`TracerProjectile`,`LinearFlareProjectile`,`Projectile`]),Wa=new Set([`GrenadeProjectile`,`EnergyProjectile`,`FlareProjectile`,`BombProjectile`]),Ga=new Set([`SeekerProjectile`]),Ka=new Set([`StaticShape`,`ScopeAlwaysShape`,`Turret`,`BeaconObject`,`ForceFieldBare`]);function qa(e){return e===`Player`?`Player`:Va.has(e)?`Vehicle`:e===`Item`?`Item`:Ha.has(e)?`Projectile`:Ka.has(e)?`Deployable`:`Ghost`}function Ja(e,t){return`${e}_${t}`}var Ya=Object.freeze({r:0,g:255,b:0}),Xa=Object.freeze({r:255,g:0,b:0}),Za=new ee,Qa=new N;function $a(e,t,n){return en?n:e}var eo=Math.PI*.494;function to(e,t){let n=Math.sin(t),r=Math.cos(t),i=Math.sin(e),a=Math.cos(e);return Za.set(-i,a*n,-a*r,0,0,r,n,0,a,i*n,-i*r,0,0,0,0,1),Qa.setFromRotationMatrix(Za),[Qa.x,Qa.y,Qa.z,Qa.w]}function no(e){let t=-e/2;return[0,Math.sin(t),0,Math.cos(t)]}function ro(e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||!Number.isFinite(e.z)||!Number.isFinite(e.w))return null;let t=-e.y,n=-e.z,r=-e.x,i=e.w,a=t*t+n*n+r*r+i*i;if(a<=1e-12)return null;let o=1/Math.sqrt(a);return[t*o,n*o,r*o,i*o]}function io(e){return Math.atan2(2*(e.w*e.z+e.x*e.y),e.w*e.w+e.x*e.x-e.y*e.y-e.z*e.z)}function ao(e){let t=2*(e.w*e.x-e.y*e.z);return Math.asin(Math.max(-1,Math.min(1,t)))}function oo(e){return e!=null&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function so(e){return!!e&&typeof e==`object`&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.z==`number`}function G(e){return!!e&&typeof e==`object`&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.z==`number`&&typeof e.w==`number`}function K(e,t){if(!t)return;let n;return n=Ha.has(e)||e.endsWith(`ProjectileData`)?t.projectileShapeName:e===`DebrisData`?t.shapeFileName:t.shapeName,typeof n==`string`&&n.length>0?n:void 0}function co(e,t){if(e)for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t}}function lo(e,t){if(e)for(let n of t){let t=e[n];if(typeof t==`string`&&t.length>0)return t}}function uo(e,t){if(e)for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}}function fo(e,t){if(!t)return;let n=lo(t,[`tracerTex0`,`textureName0`,`texture0`])??``;if(!(e===`TracerProjectile`||n.length>0&&co(t,[`tracerLength`])!=null)||!n)return;let r=lo(t,[`tracerTex1`,`textureName1`,`texture1`]),i=co(t,[`tracerLength`])??10,a=co(t,[`tracerWidth`]),o=co(t,[`tracerAlpha`]);return{kind:`tracer`,texture:n,crossTexture:r,tracerLength:i,tracerWidth:a!=null&&(co(t,[`crossViewAng`])!=null||a<=.7)?a:o??a??.5,crossViewAng:co(t,[`crossViewAng`,`crossViewFraction`])??(typeof t.tracerWidth==`number`&&t.tracerWidth>.7?t.tracerWidth:.98),crossSize:co(t,[`crossSize`,`muzzleVelocity`])??.45,renderCross:uo(t,[`renderCross`,`proximityRadius`])??!0}}function po(e,t){if(t){if(e===`LinearFlareProjectile`){let e=lo(t,[`smokeTexture`,`flareTexture`]);if(!e)return;let n=t.flareColor,r=co(t,[`size`])??.5;return{kind:`sprite`,texture:e,color:n?{r:n.r,g:n.g,b:n.b}:{r:1,g:1,b:1},size:r}}if(e===`FlareProjectile`){let e=lo(t,[`flareTexture`]);return e?{kind:`sprite`,texture:e,color:{r:1,g:.9,b:.5},size:co(t,[`size`])??4}:void 0}}}function mo(e){let t=e.states;if(!(!Array.isArray(t)||t.length===0))return t.map(e=>{let t=e=>{let t=e;return t==null?-1:t-1};return{name:e.name??``,transitionOnNotLoaded:t(e.transitionOnAmmo),transitionOnLoaded:t(e.transitionOnNoAmmo),transitionOnNoAmmo:t(e.transitionOnTarget),transitionOnAmmo:t(e.transitionOnNoTarget),transitionOnNoTarget:t(e.transitionOnWet),transitionOnTarget:t(e.transitionOnNotWet),transitionOnNotWet:t(e.transitionOnTriggerUp),transitionOnWet:t(e.transitionOnTriggerDown),transitionOnTriggerUp:t(e.transitionOnTimeout),transitionOnTriggerDown:t(e.transitionGeneric0In),transitionOnTimeout:t(e.transitionGeneric0Out),timeoutValue:e.timeoutValue,waitForTimeout:e.waitForTimeout??!1,fire:e.fire??!1,sequence:e.sequence,spin:e.spin??0,direction:e.direction??!0,scaleAnimation:e.scaleAnimation??!1,loaded:e.loaded??0,soundDataBlockId:e.sound??-1}})}function ho(e){let t=``;for(let n=0;n=32&&(t+=e[n]);return t}var go={2:0,3:1,4:2,5:3,6:4,7:5,8:6,11:7,12:8,14:9},_o=15,vo=16,yo=17;function bo(e){for(let t=0;t=32)return}}function xo(e){let t=[],n=0,r=``,i=!1;for(let a=0;a=32&&(r+=e[a]);continue}let s=go[o];s===void 0?o===_o?(r&&=(t.push({text:r,colorCode:n}),``),n=0):o>=32&&(r+=e[a]):(r&&=(t.push({text:r,colorCode:n}),``),n=s)}return r&&t.push({text:r,colorCode:n}),t}function So(e){let t=e.indexOf(`~w`);return t===-1?{text:e,wavPath:null}:{text:e.substring(0,t),wavPath:e.substring(t+2)}}function Co(e){return e?typeof e.cameraMode==`number`?`camera`:typeof e.rotationZ==`number`?`player`:null:null}var wo=new Map([[`gui/hud_new_packammo`,0],[`gui/hud_new_packcloak`,1],[`gui/hud_new_packenergy`,2],[`gui/hud_new_packrepair`,3],[`gui/hud_new_packsatchel`,4],[`gui/hud_new_packshield`,5],[`gui/hud_new_packinventory`,6],[`gui/hud_new_packmotionsens`,7],[`gui/hud_new_packradar`,8],[`gui/hud_new_packturretout`,9],[`gui/hud_new_packturretin`,10],[`gui/hud_new_packsensjam`,11],[`gui/hud_new_packturret`,12],[`gui/hud_satchel_unarmed`,18]]);function To(e){let t=e.toLowerCase();for(let[e,n]of wo)if(e===t)return n;return-1}var Eo=D(`ghostToScene`);function Do(e,t={x:0,y:0,z:0}){return e&&typeof e==`object`&&`x`in e?e:t}function Oo(e,t={r:0,g:0,b:0}){return e&&typeof e==`object`&&`r`in e?e:t}function ko(e,t={r:.5,g:.5,b:.5,a:1}){return e&&typeof e==`object`&&`r`in e?e:t}function Ao(e){if(e&&typeof e==`object`&&`elements`in e&&Array.isArray(e.elements))return e;if(e&&typeof e==`object`&&`position`in e&&`rotation`in e){let{position:t,rotation:n}=e,r=n.x*n.x,i=n.y*n.y,a=n.z*n.z,o=n.x*n.y,s=n.x*n.z,c=n.y*n.z,l=n.w*n.x,u=n.w*n.y,d=n.w*n.z;return{elements:[1-2*(i+a),2*(o+d),2*(s-u),0,2*(o-d),1-2*(r+a),2*(c+l),0,2*(s+u),2*(c-l),1-2*(r+i),0,t.x,t.y,t.z,1],position:{x:t.x,y:t.y,z:t.z}}}return{elements:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],position:{x:0,y:0,z:0}}}function jo(e,t){return{className:`TerrainBlock`,ghostIndex:e,terrFileName:t.terrFileName??``,detailTextureName:t.detailTextureName??``,squareSize:t.squareSize??8,emptySquareRuns:t.emptySquareRuns}}function Mo(e,t){return{className:`InteriorInstance`,ghostIndex:e,interiorFile:t.interiorFile??``,transform:Ao(t.transform),scale:Do(t.scale,{x:1,y:1,z:1}),showTerrainInside:t.showTerrainInside??!1,skinBase:t.skinBase??``,alarmState:t.alarmState??!1}}function No(e,t){return{className:`TSStatic`,ghostIndex:e,shapeName:t.shapeName??``,transform:Ao(t.transform),scale:Do(t.scale,{x:1,y:1,z:1})}}function Po(e,t){let n=Array.isArray(t.fogVolumes)?t.fogVolumes.map(e=>({visibleDistance:e.visibleDistance??0,minHeight:e.minHeight??0,maxHeight:e.maxHeight??0,color:Oo(e.color)})):[],r=Array.isArray(t.cloudLayers)?t.cloudLayers.map(e=>({texture:e.texture??``,heightPercent:e.heightPercent??0,speed:e.speed??0})):[];return{className:`Sky`,ghostIndex:e,materialList:t.materialList??``,fogColor:Oo(t.fogColor),visibleDistance:t.visibleDistance??1e3,fogDistance:t.fogDistance??0,skySolidColor:Oo(t.skySolidColor),useSkyTextures:t.useSkyTextures??!0,fogVolumes:n,cloudLayers:r,windVelocity:Do(t.windVelocity)}}function Fo(e,t){return{className:`Sun`,ghostIndex:e,direction:Do(t.direction,{x:.57735,y:.57735,z:-.57735}),color:ko(t.color,{r:.7,g:.7,b:.7,a:1}),ambient:ko(t.ambient,{r:.5,g:.5,b:.5,a:1}),textures:Array.isArray(t.textures)?t.textures:void 0}}function Io(e,t){return{className:`MissionArea`,ghostIndex:e,area:t.area??{x:-512,y:-512,w:1024,h:1024},flightCeiling:t.flightCeiling??2e3,flightCeilingRange:t.flightCeilingRange??50}}function Lo(e,t){return{className:`WaterBlock`,ghostIndex:e,transform:Ao(t.transform),scale:Do(t.scale,{x:1,y:1,z:1}),surfaceName:t.surfaceName??``,envMapName:t.envMapName??``,surfaceOpacity:t.surfaceOpacity??.75,waveMagnitude:t.waveMagnitude??1,envMapIntensity:t.envMapIntensity??1}}function Ro(e,t,n){let r;switch(e){case`TerrainBlock`:return r=jo(t,n),Eo.debug(`TerrainBlock #%d: terrFileName=%s`,t,r.terrFileName),r;case`InteriorInstance`:return r=Mo(t,n),Eo.debug(`InteriorInstance #%d: interiorFile=%s`,t,r.interiorFile),r;case`TSStatic`:return No(t,n);case`Sky`:{r=Po(t,n);let e=r;return Eo.debug(`Sky #%d: materialList=%s fogColor=(%s, %s, %s) visibleDist=%d fogDist=%d useSkyTextures=%s`,t,e.materialList,e.fogColor.r.toFixed(3),e.fogColor.g.toFixed(3),e.fogColor.b.toFixed(3),e.visibleDistance,e.fogDistance,e.useSkyTextures),r}case`Sun`:{r=Fo(t,n);let e=r;return Eo.debug(`Sun #%d: dir=(%s, %s, %s) color=(%s, %s, %s) ambient=(%s, %s, %s)`,t,e.direction.x.toFixed(3),e.direction.y.toFixed(3),e.direction.z.toFixed(3),e.color.r.toFixed(3),e.color.g.toFixed(3),e.color.b.toFixed(3),e.ambient.r.toFixed(3),e.ambient.g.toFixed(3),e.ambient.b.toFixed(3)),r}case`MissionArea`:return Io(t,n);case`WaterBlock`:return Lo(t,n);default:return null}}function zo(e,t){return e[t.toLowerCase()]}function Bo(e,t){let n=zo(e,t);if(n==null)return;let r=parseFloat(n);return Number.isFinite(r)?r:void 0}function Vo(e,t){let n=zo(e,t);if(n==null)return;let r=parseInt(n,10);return Number.isFinite(r)?r:void 0}function Ho(e,t={x:0,y:0,z:0}){if(!e)return t;let n=e.split(` `).map(Number);return{x:n[0]??t.x,y:n[1]??t.y,z:n[2]??t.z}}function Uo(e,t={r:0,g:0,b:0}){if(!e)return t;let n=e.split(` `).map(Number);return{r:n[0]??t.r,g:n[1]??t.g,b:n[2]??t.b}}function Wo(e,t={r:.5,g:.5,b:.5,a:1}){if(!e)return t;let n=e.split(` `).map(Number);return{r:n[0]??t.r,g:n[1]??t.g,b:n[2]??t.b,a:n[3]??t.a}}function Go(e,t){let n=Ho(e),r=(t??`1 0 0 0`).split(` `).map(Number),i=r[0]??1,a=r[1]??0,o=r[2]??0,s=(r[3]??0)*(Math.PI/180),c=Math.sqrt(i*i+a*a+o*o),l=0,u=0,d=1;c>1e-8&&(l=i/c,u=a/c,d=o/c);let f=Math.cos(s),p=Math.sin(s),m=1-f,h=Array(16).fill(0);return h[0]=m*l*l+f,h[1]=m*l*u+p*d,h[2]=m*l*d-p*u,h[4]=m*l*u-p*d,h[5]=m*u*u+f,h[6]=m*u*d+p*l,h[8]=m*l*d+p*u,h[9]=m*u*d-p*l,h[10]=m*d*d+f,h[12]=n.x,h[13]=n.y,h[14]=n.z,h[15]=1,{elements:h,position:n}}function Ko(e){if(!e)return;let t=e.split(/\s+/).map(Number).filter(Number.isFinite);return t.length>0?t:void 0}function qo(e){if(!e)return null;let t=e.split(/\s+/).map(Number),n=t[0]??0,r=t[1]??0,i=t[2]??0;return n===0&&r===0&&i===0?null:{visibleDistance:n,minHeight:r,maxHeight:i,color:{r:.5,g:.5,b:.5}}}function Jo(e){return{className:`TerrainBlock`,ghostIndex:e._id,terrFileName:zo(e,`terrainFile`)??``,detailTextureName:zo(e,`detailTexture`)??``,squareSize:Vo(e,`squareSize`)??8,emptySquareRuns:Ko(zo(e,`emptySquares`))}}function Yo(e){return{className:`InteriorInstance`,ghostIndex:e._id,interiorFile:zo(e,`interiorFile`)??``,transform:Go(zo(e,`position`),zo(e,`rotation`)),scale:Ho(zo(e,`scale`),{x:1,y:1,z:1}),showTerrainInside:zo(e,`showTerrainInside`)===`1`,skinBase:zo(e,`skinBase`)??``,alarmState:!1}}function Xo(e){let t=[];for(let n=1;n<=3;n++){let r=qo(zo(e,`fogVolume${n}`));r&&t.push(r)}let n=[];for(let t=0;t<3;t++){let r=zo(e,`cloudText${t+1}`)??``,i=Bo(e,`cloudHeightPer[${t}]`)??Bo(e,`cloudheightper${t}`)??[.35,.25,.2][t],a=Bo(e,`cloudSpeed${t+1}`)??[1e-4,2e-4,3e-4][t];n.push({texture:r,heightPercent:i,speed:a})}return{className:`Sky`,ghostIndex:e._id,materialList:zo(e,`materialList`)??``,fogColor:Uo(zo(e,`fogColor`)),visibleDistance:Bo(e,`visibleDistance`)??1e3,fogDistance:Bo(e,`fogDistance`)??0,skySolidColor:Uo(zo(e,`SkySolidColor`)),useSkyTextures:(Vo(e,`useSkyTextures`)??1)!==0,fogVolumes:t,cloudLayers:n,windVelocity:Ho(zo(e,`windVelocity`))}}function Zo(e){return{className:`Sun`,ghostIndex:e._id,direction:Ho(zo(e,`direction`),{x:.57735,y:.57735,z:-.57735}),color:Wo(zo(e,`color`),{r:.7,g:.7,b:.7,a:1}),ambient:Wo(zo(e,`ambient`),{r:.5,g:.5,b:.5,a:1})}}function Qo(e){let t=zo(e,`area`),n={x:-512,y:-512,w:1024,h:1024};if(t){let e=t.split(/\s+/).map(Number);n={x:e[0]??n.x,y:e[1]??n.y,w:e[2]??n.w,h:e[3]??n.h}}return{className:`MissionArea`,ghostIndex:e._id,area:n,flightCeiling:Bo(e,`flightCeiling`)??2e3,flightCeilingRange:Bo(e,`flightCeilingRange`)??50}}function $o(e){return{className:`WaterBlock`,ghostIndex:e._id,transform:Go(zo(e,`position`),zo(e,`rotation`)),scale:Ho(zo(e,`scale`),{x:1,y:1,z:1}),surfaceName:zo(e,`surfaceTexture`)??``,envMapName:zo(e,`envMapTexture`)??``,surfaceOpacity:Bo(e,`surfaceOpacity`)??.75,waveMagnitude:Bo(e,`waveMagnitude`)??1,envMapIntensity:Bo(e,`envMapIntensity`)??1}}function es(e){return[e.y,e.z,e.x]}function ts(e){return[e.y,e.z,e.x]}function ns(e){let t=e.elements,n=new ee,r=n.elements;r[0]=t[5],r[1]=t[6],r[2]=t[4],r[3]=0,r[4]=t[9],r[5]=t[10],r[6]=t[8],r[7]=0,r[8]=t[1],r[9]=t[2],r[10]=t[0],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1;let i=new N;return i.setFromRotationMatrix(n),i.conjugate(),i}var rs=D(`StreamEngine`),is=class{registry;ghostTracker;entities=new Map;entityIdByGhostIndex=new Map;tickCount=0;camera=null;chatMessages=[];chatMessageIdCounter=0;_chatGen=0;_chatSnapshotGen=-1;_chatSnapshot=[];audioEvents=[];netStrings=new Map;targetNames=new Map;targetTeams=new Map;targetRenderFlags=new Map;pendingNameTags=new Map;sensorGroupColors=new Map;playerSensorGroup=0;lastStatus={health:1,energy:1};latestControl={ghostIndex:-1};controlPlayerGhostId;lastControlType=`camera`;isPiloting=!1;lastPilotGhostIndex;lastVehicleHeading=0;lastVehiclePitch=0;lastVehicleOrbitDir;lastVehicleVelocity;lastVehiclePosTime=0;lastVehiclePos;firstPerson=!0;lastCameraMode;lastOrbitGhostIndex;lastOrbitDistance;latestFov=90;weaponsHud={slots:new Map,activeIndex:-1};backpackHud={packIndex:-1,active:!1,text:``};inventoryHud={slots:new Map,activeSlot:-1};teamScores=[];playerRoster=new Map;clockAnchorStreamSec=null;clockDurationMs=0;missionDisplayName=null;missionTypeDisplayName=null;gameClassName=null;serverDisplayName=null;connectedPlayerName=null;connectedClientId=null;onMissionInfoChange;nextExplosionId=0;resolveGhostClassName(e,t){if(typeof t==`number`){let e=this.registry.getGhostParser(t)?.name;if(e)return e}let n=this.entityIdByGhostIndex.get(e);if(n){let e=this.entities.get(n);if(e?.className)return e.className}let r=this.ghostTracker.getGhost(e);if(r?.className)return r.className}resolveEntityIdForGhostIndex(e){let t=this.entityIdByGhostIndex.get(e);if(t)return t;let n=this.ghostTracker.getGhost(e);if(n)return Ja(n.className,e)}resetSharedState(){this.entities.clear(),this.entityIdByGhostIndex.clear(),this.tickCount=0,this.camera=null,this.chatMessages=[],this.chatMessageIdCounter=0,this._chatGen=0,this._chatSnapshotGen=-1,this._chatSnapshot=[],this.audioEvents=[],this.netStrings.clear(),this.targetNames.clear(),this.targetTeams.clear(),this.targetRenderFlags.clear(),this.sensorGroupColors.clear(),this.playerSensorGroup=0,this.lastStatus={health:1,energy:1},this.latestControl={ghostIndex:-1},this.controlPlayerGhostId=void 0,this.lastControlType=`camera`,this.isPiloting=!1,this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0,this.firstPerson=!0,this.lastCameraMode=void 0,this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0,this.latestFov=90,this.weaponsHud={slots:new Map,activeIndex:-1},this.backpackHud={packIndex:-1,active:!1,text:``},this.inventoryHud={slots:new Map,activeSlot:-1},this.teamScores=[],this.playerRoster.clear(),this.clockAnchorStreamSec=null,this.clockDurationMs=0,this.nextExplosionId=0,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null}resolveNetString(e){if(e.length>=2&&e.charCodeAt(0)===1){let t=parseInt(e.slice(1),10);if(Number.isFinite(t))return this.netStrings.get(t)??e}return e}formatRemoteArgs(e,t){let n=this.resolveNetString(e);for(let e=0;e0&&(this.playerSensorGroup=t.sensorGroup)}if(t){let e=Co(t);if(e&&(this.lastControlType=e),this.lastControlType===`player`)this.isPiloting=!!(t.pilot||t.controlObjectGhost!=null),this.isPiloting&&typeof t.controlObjectGhost==`number`?this.lastPilotGhostIndex=t.controlObjectGhost:this.isPiloting||(this.lastPilotGhostIndex=void 0,this.lastVehicleHeading=0,this.lastVehiclePitch=0,this.lastVehicleOrbitDir=void 0,this.lastVehicleVelocity=void 0,this.lastVehiclePosTime=0,this.lastVehiclePos=void 0);else if(this.isPiloting=!1,typeof t.cameraMode==`number`)if(this.lastCameraMode=t.cameraMode,t.cameraMode===3){typeof t.orbitObjectGhostIndex==`number`&&(this.lastOrbitGhostIndex=t.orbitObjectGhostIndex);let e=t.minOrbitDist,n=t.maxOrbitDist,r=t.curOrbitDist;typeof e==`number`&&typeof n==`number`&&Number.isFinite(e)&&Number.isFinite(n)?this.lastOrbitDistance=Math.max(0,n-e):typeof r==`number`&&Number.isFinite(r)&&(this.lastOrbitDistance=Math.max(0,r))}else this.lastOrbitGhostIndex=void 0,this.lastOrbitDistance=void 0}e.cameraFov!==void 0&&(this.latestFov=e.cameraFov)}processEvent(e,t){let n=e.parsedData;if(!n)return;let r=n.type;if(r===`GhostAlwaysObjectEvent`){let e=n.ghostIndex,t=n.classId,r=n.objectData,i=n._hasObjectData,a=typeof t==`number`?this.registry.getGhostParser(t)?.name??`classId=${t}`:`?`;rs.debug(`GhostAlwaysObjectEvent: ghost=%d class=%s hasData=%s %s`,e,a,i,r?`keys=[${Object.keys(r).join(`,`)}]`:`(no data)`),e!=null&&t!=null&&this.processGhostUpdate({index:e,type:`create`,classId:t,parsedData:r});return}if(r===`NetStringEvent`||t===`NetStringEvent`){let e=n.id,t=n.value;if(e!=null&&typeof t==`string`){this.netStrings.set(e,t);let n=this.pendingNameTags.get(e);if(n!=null){this.pendingNameTags.delete(e);let r=ho(t).trim();this.targetNames.set(n,r);for(let e of this.entities.values())e.targetId===n&&(e.playerName=r)}}return}if(r===`TargetInfoEvent`||t===`TargetInfoEvent`){let e=n.targetId,t=n.nameTag;if(e!=null&&t!=null){let n=this.netStrings.get(t);n?this.targetNames.set(e,ho(n).trim()):this.pendingNameTags.set(t,e)}let r=n.sensorGroup;e!=null&&r!=null&&this.targetTeams.set(e,r);let i=n.renderFlags;if(e!=null&&i!=null&&this.targetRenderFlags.set(e,i),e!=null){let t=this.targetNames.get(e),n=this.targetTeams.get(e),r=this.targetRenderFlags.get(e);for(let i of this.entities.values())i.targetId===e&&(t&&(i.playerName=t),n!=null&&(i.sensorGroup=n),r!=null&&(i.targetRenderFlags=r))}return}if(r===`SetSensorGroupEvent`||t===`SetSensorGroupEvent`){let e=n.sensorGroup;e!=null&&(this.playerSensorGroup=e);return}if(r===`SensorGroupColorEvent`||t===`SensorGroupColorEvent`){let e=n.sensorGroup,t=n.colors;if(t){let n=this.sensorGroupColors.get(e);n||(n=new Map,this.sensorGroupColors.set(e,n));for(let e of t)e.default?n.delete(e.index):n.set(e.index,{r:e.r??0,g:e.g??0,b:e.b??0})}return}if(r===`RemoteCommandEvent`||t===`RemoteCommandEvent`){let e=this.resolveNetString(n.funcName),t=n.args,r=this.getTimeSec();if(e===`ChatMessage`&&t.length>=4){let e=bo(this.resolveNetString(t[3])),n=t[4]?ho(this.resolveNetString(t[4])):``,i=this.formatRemoteArgs(t[3],t.slice(4));if(i){let a=i.indexOf(`: `),{text:o,wavPath:s}=So(a>=0?i.slice(a+2):i),c,l;if(s){let e=this.resolveNetString(t[1]);c=e?`voice/${e}/${s}.wav`:s;let n=this.resolveNetString(t[2]);if(n){let e=parseFloat(n);Number.isFinite(e)&&(l=Math.max(.5,Math.min(2,e)))}}let u=e??0;this.pushChatMessage({timeSec:r,sender:n,text:o,kind:`chat`,colorCode:u,segments:[{text:n?`${n}: ${o}`:o,colorCode:u}],soundPath:c,soundPitch:l})}}else if(e===`CannedChatMessage`&&t.length>=6){let e=bo(this.resolveNetString(t[1])),n=ho(this.resolveNetString(t[2])),i=ho(this.resolveNetString(t[4])),a=this.formatRemoteArgs(t[1],t.slice(2));if(a){let{wavPath:o}=So(a),s=So(ho(this.resolveNetString(t[3]))).text,c,l;if(o){let e=this.resolveNetString(t[5]);if(c=e?`voice/${e}/${o}.wav`:o,t[6]){let e=parseFloat(this.resolveNetString(t[6]));Number.isFinite(e)&&(l=Math.max(.5,Math.min(2,e)))}}let u=e??0,d=[];i&&d.push({text:`[${i}] `,colorCode:0}),d.push({text:n?`${n}: ${s}`:s,colorCode:u}),this.pushChatMessage({timeSec:r,sender:n,text:s,kind:`chat`,colorCode:u,segments:d,soundPath:c,soundPitch:l})}}else if(e===`ServerMessage`&&t.length>=2){this.handleServerMessage(t);let e=bo(this.resolveNetString(t[1])),n=this.formatRemoteArgs(t[1],t.slice(2));if(n){let{text:t,wavPath:i}=So(n),a=e??0;this.pushChatMessage({timeSec:r,sender:``,text:t,kind:`server`,colorCode:a,segments:[{text:t,colorCode:a}],soundPath:i??void 0})}}else this.handleHudRemoteCommand(e,t);return}if(r===`Sim3DAudioEvent`||r===`Sim2DAudioEvent`||t===`Sim3DAudioEvent`||t===`Sim2DAudioEvent`){let e=n.profileId;if(typeof e==`number`){let i=this.getTimeSec(),a=r===`Sim3DAudioEvent`||t===`Sim3DAudioEvent`?n.position:void 0;this.audioEvents.push({profileId:e,position:a,timeSec:i}),this.audioEvents.length>100&&this.audioEvents.splice(0,this.audioEvents.length-100)}}}processGhostUpdate(e){let t=e.index,n=this.entityIdByGhostIndex.get(t);if(n){let t=this.entities.get(n);t&&t.type===`Projectile`&&!t.hasExploded&&t.explosionDataBlockId!=null&&t.position&&(e.type===`delete`||e.type===`create`)&&this.spawnExplosion(t,[...t.position])}if(e.type===`delete`){n&&(this.removeSoundSlotEntities(n),this.entities.delete(n),this.entityIdByGhostIndex.delete(t));return}let r=this.resolveGhostClassName(t,e.classId);if(!r){if(e.type===`create`)throw Error(`No ghost parser for classId ${e.classId} (ghost index ${t})`);return}let i=Ja(r,t);n&&n!==i&&(this.removeSoundSlotEntities(n),this.entities.delete(n));let a,o=this.entities.get(i);if(o&&e.type===`create`?(this.removeSoundSlotEntities(i),o.spawnTick=this.tickCount,this.resetEntity(o),a=o):o?a=o:(a={id:i,ghostIndex:t,className:r,spawnTick:this.tickCount,type:qa(r),rotation:[0,0,0,1]},this.entities.set(i,a)),a.ghostIndex=t,a.className=r,a.type=qa(r),this.entityIdByGhostIndex.set(t,i),this.applyGhostData(a,e.parsedData),e.type===`create`&&e.parsedData){let n=Ro(r,t,e.parsedData);n&&(a.sceneData=n)}}resetEntity(e){e.rotation=[0,0,0,1],e.hasExploded=void 0,e.explosionShape=void 0,e.explosionLifetimeTicks=void 0,e.faceViewer=void 0,e.simulatedVelocity=void 0,e.projectilePhysics=void 0,e.gravityMod=void 0,e.direction=void 0,e.velocity=void 0,e.position=void 0,e.dataBlock=void 0,e.dataBlockId=void 0,e.shapeHint=void 0,e.visual=void 0,e.targetId=void 0,e.targetRenderFlags=void 0,e.carryingFlag=void 0,e.sensorGroup=void 0,e.playerName=void 0,e.weaponShape=void 0,e.packShape=void 0,e.falling=void 0,e.jetting=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0,e.weaponImageStatesDbId=void 0,e.itemPhysics=void 0,e.threads=void 0,e.headPitch=void 0,e.headYaw=void 0,e.health=void 0,e.energy=void 0,e.maxEnergy=void 0,e.damageState=void 0,e.actionAnim=void 0,e.actionAtEnd=void 0,e.explosionDataBlockId=void 0,e.maintainEmitterId=void 0}applyGhostData(e,t){if(!t)return;let n=t,r=n.dataBlockId;if(r!=null){e.dataBlockId=r;let t=this.getDataBlockData(r),n=K(e.className,t);if(e.visual=fo(e.className,t)??po(e.className,t),typeof n==`string`&&(e.shapeHint=n,e.dataBlock=n),e.type===`Player`&&typeof t?.maxEnergy==`number`&&(e.maxEnergy=t.maxEnergy),e.type===`Projectile`&&(Ua.has(e.className)?e.projectilePhysics=`linear`:Wa.has(e.className)?(e.projectilePhysics=`ballistic`,e.gravityMod=co(t,[`gravityMod`])??1):Ga.has(e.className)&&(e.projectilePhysics=`seeker`)),e.type===`Projectile`&&e.explosionDataBlockId==null){let t=this.resolveExplosionInfo(r);t&&(e.explosionShape=t.shape,e.faceViewer=t.faceViewer,e.explosionLifetimeTicks=t.lifetimeTicks,e.explosionDataBlockId=t.explosionDataBlockId)}if(e.type===`Projectile`&&e.maintainEmitterId==null){let n=t?.baseEmitter;typeof n==`number`&&n>0&&(e.maintainEmitterId=n)}}if(e.type===`Player`){let t=n.images;if(Array.isArray(t)&&t.length>0){let n=t.find(e=>e.index===0);if(n?.dataBlockId&&n.dataBlockId>0){let t=this.getDataBlockData(n.dataBlockId),r=K(`ShapeBaseImageData`,t);if(r){let n=t?.mountPoint;(n==null||n<=0)&&!/pack_/i.test(r)&&(e.weaponShape=r)}let i=e.weaponImageState;e.weaponImageState={dataBlockId:n.dataBlockId,triggerDown:n.triggerDown??i?.triggerDown??!1,ammo:n.ammo??i?.ammo??!0,loaded:n.loaded??i?.loaded??!0,target:n.target??i?.target??!1,wet:n.wet??i?.wet??!1,fireCount:n.fireCount??i?.fireCount??0},t&&e.weaponImageStatesDbId!==n.dataBlockId&&(e.weaponImageStates=mo(t),e.weaponImageStatesDbId=n.dataBlockId)}else n&&!n.dataBlockId&&(e.weaponShape=void 0,e.weaponImageState=void 0,e.weaponImageStates=void 0);let r=t.find(e=>e.index===2);if(r?.dataBlockId&&r.dataBlockId>0){let t=K(`ShapeBaseImageData`,this.getDataBlockData(r.dataBlockId));t&&(e.packShape=t)}else r&&!r.dataBlockId&&(e.packShape=void 0);let i=t.find(e=>e.index===3);if(i?.dataBlockId&&i.dataBlockId>0){e.carryingFlag=!0;let t=K(`ShapeBaseImageData`,this.getDataBlockData(i.dataBlockId));if(t&&(e.flagShape=t),e.targetId!=null&&e.targetId>=0){let t=this.targetRenderFlags.get(e.targetId)??0,n=t|2;n!==t&&(this.targetRenderFlags.set(e.targetId,n),e.targetRenderFlags=n)}}else if(i&&!i.dataBlockId&&(e.carryingFlag=!1,e.flagShape=void 0,e.targetId!=null&&e.targetId>=0)){let t=this.targetRenderFlags.get(e.targetId)??0,n=t&-3;n!==t&&(this.targetRenderFlags.set(e.targetId,n),e.targetRenderFlags=n)}}}let i=oo(n.position)?n.position:oo(n.initialPosition)?n.initialPosition:oo(n.explodePosition)?n.explodePosition:oo(n.endPoint)?n.endPoint:oo(n.transform?.position)?n.transform.position:void 0;i&&(e.position=[i.x,i.y,i.z],this.updateSoundSlotPositions(e));let a=so(n.direction)?n.direction:void 0;if(a&&(e.direction=[a.x,a.y,a.z]),e.type===`Player`&&typeof n.rotationZ==`number`&&(e.rotation=no(n.rotationZ)),e.type===`Player`&&(typeof n.headX==`number`&&(e.headPitch=n.headX),typeof n.headZ==`number`&&(e.headYaw=n.headZ)),G(n.angPosition)){let t=ro(n.angPosition);t&&(e.rotation=t)}else if(G(n.transform?.rotation)){let t=ro(n.transform.rotation);t&&(e.rotation=t)}else if(e.type===`Item`&&typeof n.rotation?.angle==`number`){let t=n.rotation;e.rotation=no((t.zSign??1)*t.angle)}else if(e.type===`Projectile`){let t=n.velocity??n.direction??(oo(n.initialPosition)&&oo(n.endPos)?{x:n.endPos.x-n.initialPosition.x,y:n.endPos.y-n.initialPosition.y,z:n.endPos.z-n.initialPosition.z}:void 0);so(t)&&(t.x!==0||t.y!==0)&&(e.rotation=no(Math.atan2(t.x,t.y)))}if(so(n.velocity)&&(e.velocity=[n.velocity.x,n.velocity.y,n.velocity.z],e.direction||=[n.velocity.x,n.velocity.y,n.velocity.z]),typeof n.moveFlag0==`boolean`&&(e.falling=n.moveFlag0),typeof n.moveFlag1==`boolean`&&(e.jetting=n.moveFlag1),e.type===`Item`){let t=n.atRest;t===!1&&so(n.velocity)?e.itemPhysics={velocity:[n.velocity.x,n.velocity.y,n.velocity.z],atRest:!1}:t===!0&&(e.itemPhysics=void 0)}if(e.projectilePhysics){if(e.projectilePhysics===`linear`){let t=co(e.dataBlockId==null?void 0:this.getDataBlockData(e.dataBlockId),[`dryVelocity`,`muzzleVelocity`,`bulletVelocity`])??80,r=e.direction??[0,1,0],i=r[0]*t,a=r[1]*t,o=r[2]*t,s=n.excessVel,c=n.excessDir;typeof s==`number`&&s>0&&so(c)&&(i+=c.x*s,a+=c.y*s,o+=c.z*s),e.simulatedVelocity=[i,a,o]}else so(n.velocity)&&(e.simulatedVelocity=[n.velocity.x,n.velocity.y,n.velocity.z]);let t=n.currTick;if(typeof t==`number`&&t>0&&e.simulatedVelocity&&e.position){let n=32/1e3*t,r=e.simulatedVelocity;if(e.position[0]+=r[0]*n,e.position[1]+=r[1]*n,e.position[2]+=r[2]*n,e.projectilePhysics===`ballistic`){let t=-9.81*(e.gravityMod??1);e.position[2]+=.5*t*n*n,r[2]+=t*n}}}let o=oo(n.explodePosition)?n.explodePosition:oo(n.explodePoint)?n.explodePoint:void 0;if(e.type===`Projectile`&&!e.hasExploded&&o&&e.explosionDataBlockId!=null&&this.spawnExplosion(e,[o.x,o.y,o.z]),typeof n.damageLevel==`number`&&(e.health=$a(1-n.damageLevel,0,1)),typeof n.damageState==`number`&&(e.damageState=n.damageState),typeof n.action==`number`&&(e.actionAnim=n.action,e.actionAtEnd=!!n.actionAtEnd),Array.isArray(n.threads)){let t=n.threads;if(e.threads){let n=[...e.threads];for(let e of t){let t=n.findIndex(t=>t.index===e.index);t>=0?n[t]=e:n.push(e)}e.threads=n}else e.threads=t}if(typeof n.energy==`number`&&(e.energy=$a(n.energy,0,1)),typeof n.targetId==`number`){e.targetId=n.targetId;let t=this.targetNames.get(n.targetId);t&&(e.playerName=t);let r=this.targetTeams.get(n.targetId);r!=null&&(e.sensorGroup=r,e.ghostIndex===this.latestControl.ghostIndex&&this.lastControlType===`player`&&(this.playerSensorGroup=r));let i=this.targetRenderFlags.get(n.targetId);i!=null&&(e.targetRenderFlags=i)}let s=n.sounds;Array.isArray(s)&&this.syncSoundSlotEntities(e,s),e.className===`WayPoint`&&typeof n.name==`string`&&(e.label=n.name),e.className===`AudioEmitter`&&(typeof n.filename==`string`&&(e.audioFileName=n.filename),typeof n.volume==`number`&&(e.audioVolume=n.volume),typeof n.is3D==`boolean`&&(e.audioIs3D=n.is3D),typeof n.isLooping==`boolean`&&(e.audioIsLooping=n.isLooping),typeof n.minDistance==`number`&&(e.audioMinDistance=n.minDistance),typeof n.maxDistance==`number`&&(e.audioMaxDistance=n.maxDistance),typeof n.minLoopGap==`number`&&(e.audioMinLoopGap=n.minLoopGap),typeof n.maxLoopGap==`number`&&(e.audioMaxLoopGap=n.maxLoopGap))}syncSoundSlotEntities(e,t){for(let n of t){let t=`${e.id}:sound:${n.index}`;if(n.playing&&typeof n.profileId==`number`){let r=this.getDataBlockData(n.profileId),i=r?.filename;if(!i)continue;let a=i.endsWith(`.wav`)?i:`${i}.wav`,o=r.description,s=o==null?void 0:this.getDataBlockData(o),c=this.entities.get(t);c?c.position=e.position:this.entities.set(t,{id:t,ghostIndex:e.ghostIndex,className:`AudioEmitter`,type:`AudioEmitter`,spawnTick:this.tickCount,position:e.position,rotation:[0,0,0,1],audioFileName:a,audioVolume:s?.volume??1,audioIs3D:s?.is3D??!0,audioIsLooping:s?.isLooping??!1,audioMinDistance:s?.referenceDistance??20,audioMaxDistance:s?.maxDistance??100,audioMinLoopGap:s?.minLoopGap??0,audioMaxLoopGap:s?.maxLoopGap??0})}else this.entities.delete(t)}}updateSoundSlotPositions(e){for(let t=0;t<4;t++){let n=this.entities.get(`${e.id}:sound:${t}`);n&&(n.position=e.position)}}removeSoundSlotEntities(e){for(let t=0;t<4;t++)this.entities.delete(`${e}:sound:${t}`)}resolveExplosionInfo(e){let t=this.getDataBlockData(e);if(!t)return;let n=t.explosion;if(n==null)return;let r=this.getDataBlockData(n);if(!r)return;let i=r.dtsFileName||void 0,a=r.lifetimeMS??31;return{shape:i,faceViewer:r.faceViewer!==!1&&r.faceViewer!==0,lifetimeTicks:a,explosionDataBlockId:n}}spawnExplosion(e,t){e.hasExploded=!0;let n=e.explosionLifetimeTicks??31,r=`fx_${this.nextExplosionId++}`,i={id:r,ghostIndex:-1,className:`Explosion`,spawnTick:this.tickCount,type:`Explosion`,dataBlock:e.explosionShape,explosionDataBlockId:e.explosionDataBlockId,position:t,rotation:[0,0,0,1],isExplosion:!0,faceViewer:e.faceViewer!==!1,expiryTick:this.tickCount+n};if(this.entities.set(r,i),e.explosionDataBlockId!=null){let n=this.getDataBlockData(e.explosionDataBlockId)?.subExplosions;if(Array.isArray(n))for(let e of n){if(e==null)continue;let n=this.getDataBlockData(e);if(!n)continue;let r=n.dtsFileName||void 0;if(!r)continue;let i=n.lifetimeMS??31,a=n.offset??0,o=Math.random()*Math.PI*2,s=[t[0]+Math.cos(o)*a,t[1]+Math.sin(o)*a,t[2]],c=`fx_${this.nextExplosionId++}`,l={id:c,ghostIndex:-1,className:`Explosion`,spawnTick:this.tickCount,type:`Explosion`,dataBlock:r,explosionDataBlockId:e,position:s,rotation:[0,0,0,1],isExplosion:!0,faceViewer:n.faceViewer!==!1&&n.faceViewer!==0,expiryTick:this.tickCount+i};this.entities.set(c,l)}}e.position=void 0,e.simulatedVelocity=void 0}advanceProjectiles(){let e=32/1e3;for(let t of this.entities.values()){if(!t.simulatedVelocity||!t.position)continue;let n=t.simulatedVelocity,r=t.position;t.projectilePhysics===`ballistic`&&(n[2]+=-9.81*(t.gravityMod??1)*e),r[0]+=n[0]*e,r[1]+=n[1]*e,r[2]+=n[2]*e,(n[0]!==0||n[1]!==0)&&(t.rotation=no(Math.atan2(n[0],n[1])))}}advanceItems(){let e=32/1e3;for(let t of this.entities.values()){let n=t.itemPhysics;if(!n||n.atRest||!t.position)continue;let r=n.velocity,i=t.position;i[0]+=r[0]*e,i[1]+=r[1]*e,i[2]+=r[2]*e}}removeExpiredExplosions(){for(let[e,t]of this.entities)t.isExplosion&&t.expiryTick!=null&&this.tickCount>=t.expiryTick&&this.entities.delete(e)}updateCameraAndHud(){let e=this.latestControl,t=this.getTimeSec(),n=e.data,r=this.lastControlType;if(this.removeExpiredExplosions(),e.position){let{yaw:i,pitch:a}=this.getCameraYawPitch(n);if(this.isPiloting){if(n){let e=n.controlObjectData?.angPosition;if(e&&typeof e.w==`number`){this.lastVehicleHeading=io(e),this.lastVehiclePitch=ao(e);let t=ro(e);if(t){let[e,n,r,i]=t,a=1-2*(n*n+r*r),o=2*(e*n+r*i),s=2*(e*r-n*i);this.lastVehicleOrbitDir=[-a,-o,-s]}}}i=this.lastVehicleHeading,a=this.lastVehiclePitch}if(this.camera={time:t,position:[e.position.x,e.position.y,e.position.z],rotation:to(i,$a(a,-eo,eo)),fov:this.latestFov,mode:`observer`,yaw:i,pitch:a},r===`camera`)if((typeof n?.cameraMode==`number`?n.cameraMode:this.lastCameraMode)===3){this.camera.mode=`third-person`,typeof this.lastOrbitDistance==`number`&&(this.camera.orbitDistance=this.lastOrbitDistance);let e=typeof n?.orbitObjectGhostIndex==`number`?n.orbitObjectGhostIndex:this.lastOrbitGhostIndex;typeof e==`number`&&e>=0&&(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(e))}else this.camera.mode=`observer`;else e.ghostIndex>=0&&(this.controlPlayerGhostId=this.resolveEntityIdForGhostIndex(e.ghostIndex)),this.firstPerson?this.camera.mode=`first-person`:(this.camera.mode=`third-person`,this.isPiloting&&this.lastPilotGhostIndex!=null?(this.camera.orbitTargetId=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),this.camera.orbitDistance=15,this.lastVehicleOrbitDir&&(this.camera.orbitDirection=this.lastVehicleOrbitDir)):(this.camera.orbitTargetId=this.controlPlayerGhostId,this.camera.orbitDistance=3)),this.controlPlayerGhostId&&(this.camera.controlEntityId=this.controlPlayerGhostId);if(r===`player`&&e.position){if(this.isPiloting&&this.lastPilotGhostIndex!=null){let r=this.resolveEntityIdForGhostIndex(this.lastPilotGhostIndex),i=r?this.entities.get(r):void 0;if(i){let r=n?.controlObjectData;if(r){i.position=[e.position.x,e.position.y,e.position.z],this.lastVehiclePos=i.position.slice(),this.lastVehiclePosTime=t;let n=r.linMomentum;if(n&&oo(n)){let e=i.dataBlockId,t=(e==null?void 0:this.getDataBlockData(e))?.mass??200,r=t>0?1/t:1/200;this.lastVehicleVelocity=[n.x*r,n.y*r,n.z*r],i.velocity=this.lastVehicleVelocity}let a=r.angPosition;if(a&&typeof a.w==`number`){let e=ro(a);e&&(i.rotation=e)}}else if(this.lastVehiclePos&&this.lastVehicleVelocity&&this.lastVehiclePosTime>0){let e=t-this.lastVehiclePosTime;if(e>0&&e<1){let[t,n,r]=this.lastVehicleVelocity;i.position=[this.lastVehiclePos[0]+t*e,this.lastVehiclePos[1]+n*e,this.lastVehiclePos[2]+r*e]}}}}else if(this.controlPlayerGhostId){let t=this.entities.get(this.controlPlayerGhostId);if(t){t.position=[e.position.x,e.position.y,e.position.z],t.rotation=no(i),t.headPitch=this.getControlPlayerHeadPitch(a);let r=n?.velocity;so(r)&&(t.velocity=[r.x,r.y,r.z],t.falling=r.z<-10)}}}}else this.camera&&={...this.camera,time:t,fov:this.latestFov};let i={health:1,energy:1};if(this.camera?.mode===`first-person`){let e=this.controlPlayerGhostId,t=e?this.entities.get(e):void 0;i.health=t?.health??1;let r=n?.energyLevel;if(typeof r==`number`){let e=t?.maxEnergy??60;e>0&&(i.energy=$a(r/e,0,1))}else i.energy=t?.energy??1}else if(this.camera?.mode===`third-person`&&this.camera.orbitTargetId){let e=this.entities.get(this.camera.orbitTargetId);i.health=e?.health??1,i.energy=e?.energy??1}this.lastStatus=i}getControlPlayerHeadPitch(e){return $a(e/eo,-1,1)}getAbsoluteRotation(e){return e?typeof e.rotationZ==`number`&&typeof e.headX==`number`?{yaw:e.rotationZ,pitch:e.headX}:typeof e.rotZ==`number`&&typeof e.rotX==`number`?{yaw:e.rotZ,pitch:e.rotX}:null:null}resolveIffColor(e){if(this.playerSensorGroup===0)return;let t=this.sensorGroupColors.get(this.playerSensorGroup);if(t){let n=t.get(e);if(n)return n}if(e===this.playerSensorGroup)return Ya;if(e!==0)return Xa}pushChatMessage(e){this.chatMessages.push({...e,id:++this.chatMessageIdCounter}),this.chatMessages.length>200&&this.chatMessages.splice(0,this.chatMessages.length-200),this._chatGen++}handleServerMessage(e){if(e.length<2)return;let t=this.resolveNetString(e[0]);if((t===`MsgTeamScoreIs`||t===`MsgTeamScore`)&&e.length>=4){let t=parseInt(this.resolveNetString(e[2]),10),n=parseInt(this.resolveNetString(e[3]),10);if(!isNaN(t)&&!isNaN(n)){let e=this.teamScores.find(e=>e.teamId===t);e&&(e.score=n,this.onTeamScoresChanged())}}else if(t===`MsgCTFAddTeam`&&e.length>=6){let t=parseInt(this.resolveNetString(e[2]),10),n=ho(this.resolveNetString(e[3])),r=parseInt(this.resolveNetString(e[5]),10);if(!isNaN(t)&&t>0){let e=this.teamScores.find(e=>e.teamId===t);e?(e.name=n,e.score=isNaN(r)?e.score:r):this.teamScores.push({teamId:t,name:n,score:isNaN(r)?0:r,playerCount:0}),this.onTeamScoresChanged()}}else if(t===`MsgClientJoin`&&e.length>=4){let t=ho(this.resolveNetString(e[2])).trim(),n=parseInt(this.resolveNetString(e[3]),10);isNaN(n)||(this.playerRoster.set(n,{name:t,teamId:0,score:0,ping:0,packetLoss:0}),this.onRosterChanged()),!this.connectedPlayerName&&t&&ho(this.resolveNetString(e[1])).includes(`Welcome to Tribes`)&&(this.connectedPlayerName=t,this.connectedClientId=n,this.onMissionInfoChange?.())}else if(t===`MsgClientDrop`&&e.length>=4){let t=parseInt(this.resolveNetString(e[3]),10);isNaN(t)||(this.playerRoster.delete(t),this.onRosterChanged())}else if(t===`MsgClientJoinTeam`&&e.length>=6){let t=parseInt(this.resolveNetString(e[4]),10),n=parseInt(this.resolveNetString(e[5]),10);if(!isNaN(t)&&!isNaN(n)){let e=this.playerRoster.get(t);e?e.teamId=n:this.playerRoster.set(t,{name:``,teamId:n,score:0,ping:0,packetLoss:0}),this.onRosterChanged()}}else if(t===`MsgPlayerScore`&&e.length>=5){let t=parseInt(this.resolveNetString(e[2]),10);if(!isNaN(t)){let n=this.playerRoster.get(t);if(n){let t=parseInt(this.resolveNetString(e[3]),10),r=parseInt(this.resolveNetString(e[4]),10),i=parseInt(this.resolveNetString(e[5]??``),10);isNaN(t)||(n.score=t),isNaN(r)||(n.ping=r),isNaN(i)||(n.packetLoss=i),this.onRosterChanged()}}}else if(t===`MsgSystemClock`&&e.length>=4){let t=parseFloat(this.resolveNetString(e[3]));this.clockAnchorStreamSec=this.getTimeSec(),this.clockDurationMs=Number.isFinite(t)?t:0}else if(t===`MsgMissionDropInfo`&&e.length>=5){let t=ho(this.resolveNetString(e[2])),n=ho(this.resolveNetString(e[3])),r=ho(this.resolveNetString(e[4]));rs.info(`mission drop info: mission=%s gameType=%s server=%s`,t,n,r),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=n||this.missionTypeDisplayName,this.serverDisplayName=r||this.serverDisplayName,this.onMissionInfoChange?.()}else if(t===`MsgLoadInfo`&&e.length>=5){let t=ho(this.resolveNetString(e[3])),n=ho(this.resolveNetString(e[4]));rs.info(`load info: mission=%s gameType=%s`,t,n),this.missionDisplayName=t||this.missionDisplayName,this.missionTypeDisplayName=n||this.missionTypeDisplayName,this.onMissionInfoChange?.()}else if(t===`MsgClientReady`&&e.length>=3){let t=this.resolveNetString(e[2]);rs.info(`client ready: gameClass=%s`,t),this.gameClassName=t||this.gameClassName,this.onMissionInfoChange?.()}}onTeamScoresChanged(){}onRosterChanged(){}handleHudRemoteCommand(e,t){if(e===`setWeaponsHudItem`&&t.length>=3){let e=parseInt(t[0],10),n=parseInt(t[1],10),r=t[2]===`1`||t[2]===`true`;isNaN(e)||(r?this.weaponsHud.slots.set(e,isNaN(n)?-1:n):this.weaponsHud.slots.delete(e),this.onWeaponsHudChanged())}else if(e===`setWeaponsHudAmmo`&&t.length>=2){let e=parseInt(t[0],10),n=parseInt(t[1],10);isNaN(e)||(this.weaponsHud.slots.set(e,isNaN(n)?-1:n),this.onWeaponsHudChanged())}else if(e===`setWeaponsHudActive`&&t.length>=1){let e=parseInt(t[0],10);this.weaponsHud.activeIndex=isNaN(e)?-1:e,!isNaN(e)&&e>=0&&!this.weaponsHud.slots.has(e)&&this.weaponsHud.slots.set(e,-1),this.onWeaponsHudChanged()}else if(e===`setWeaponsHudClearAll`)this.weaponsHud.slots.clear(),this.weaponsHud.activeIndex=-1,this.onWeaponsHudChanged();else if(e===`setBackpackHudItem`&&t.length>=2){let e=parseInt(t[0],10);(t[1]===`1`||t[1]===`true`)&&!isNaN(e)?(this.backpackHud.packIndex=e,this.backpackHud.active=!1,this.backpackHud.text=``):(this.backpackHud.packIndex=-1,this.backpackHud.active=!1,this.backpackHud.text=``)}else if(e===`setSatchelArmed`)this.backpackHud.active=!0;else if(e===`setCloakIconOn`||e===`setRepairPackIconOn`||e===`setShieldIconOn`||e===`setSenJamIconOn`)this.backpackHud.active=!0;else if(e===`setCloakIconOff`||e===`setRepairPackIconOff`||e===`setShieldIconOff`||e===`setSenJamIconOff`)this.backpackHud.active=!1;else if(e===`updatePackText`&&t.length>=1)this.backpackHud.text=t[0]??``;else if(e===`setInventoryHudItem`&&t.length>=3){let e=parseInt(t[0],10),n=parseInt(t[1],10),r=t[2]===`1`||t[2]===`true`;isNaN(e)||(r&&!isNaN(n)?this.inventoryHud.slots.set(e,n):this.inventoryHud.slots.delete(e),this.onInventoryHudChanged())}else if(e===`setInventoryHudAmount`&&t.length>=2){let e=parseInt(t[0],10),n=parseInt(t[1],10);!isNaN(e)&&!isNaN(n)&&(this.inventoryHud.slots.set(e,n),this.onInventoryHudChanged())}else e===`setInventoryHudClearAll`&&(this.inventoryHud.slots.clear(),this.inventoryHud.activeSlot=-1,this.onInventoryHudChanged())}onWeaponsHudChanged(){}onInventoryHudChanged(){}buildEntityList(e){let t=[];for(let n of this.entities.values()){if(e&&!e(n))continue;let r=n.targetId!=null&&n.targetId>=0?this.targetRenderFlags.get(n.targetId)??n.targetRenderFlags:n.targetRenderFlags;n.type===`Player`&&!n.carryingFlag&&(r=r==null?r:r&-3),t.push({id:n.id,type:n.type,visual:n.visual,direction:n.direction,ghostIndex:n.ghostIndex,className:n.className,dataBlockId:n.dataBlockId,shapeHint:n.shapeHint,dataBlock:n.dataBlock,weaponShape:n.weaponShape,packShape:n.packShape,flagShape:n.flagShape,falling:n.falling,jetting:n.jetting,playerName:n.playerName,targetRenderFlags:r,iffColor:(n.type===`Player`||(r??0)&2)&&n.sensorGroup!=null?this.resolveIffColor(n.sensorGroup):void 0,position:n.position&&(n.simulatedVelocity||n.itemPhysics&&!n.itemPhysics.atRest)?[...n.position]:n.position,rotation:n.rotation,velocity:n.velocity,health:n.health,energy:n.energy,actionAnim:n.actionAnim,actionAtEnd:n.actionAtEnd,damageState:n.damageState,faceViewer:n.faceViewer,threads:n.threads,explosionDataBlockId:n.explosionDataBlockId,maintainEmitterId:n.maintainEmitterId,weaponImageState:n.weaponImageState,weaponImageStates:n.weaponImageStates,headPitch:n.headPitch,headYaw:n.headYaw,label:n.label,audioFileName:n.audioFileName,audioVolume:n.audioVolume,audioIs3D:n.audioIs3D,audioIsLooping:n.audioIsLooping,audioMinDistance:n.audioMinDistance,audioMaxDistance:n.audioMaxDistance,audioMinLoopGap:n.audioMinLoopGap,audioMaxLoopGap:n.audioMaxLoopGap,sceneData:n.sceneData})}return t}computeMatchClockMs(e){if(this.clockAnchorStreamSec==null)return null;let t=(e-this.clockAnchorStreamSec)*1e3;return-this.clockDurationMs+t}buildHudState(){let e={slots:Array.from(this.weaponsHud.slots.entries()).map(([e,t])=>({index:e,ammo:t})),activeIndex:this.weaponsHud.activeIndex},t={slots:Array.from(this.inventoryHud.slots.entries()).map(([e,t])=>({slot:e,count:t})),activeSlot:this.inventoryHud.activeSlot},n=this.backpackHud.packIndex>=0?{...this.backpackHud}:null,r=this.teamScores.map(e=>({...e})),i=new Map;for(let{teamId:e}of this.playerRoster.values())e>0&&i.set(e,(i.get(e)??0)+1);for(let e of r)e.playerCount=i.get(e.teamId)??0;let a=[];for(let[e,t]of this.playerRoster)a.push({clientId:e,...t});return{weaponsHud:e,inventoryHud:t,backpackHud:n,teamScores:r,playerRoster:a}}buildTimeFilteredEvents(e){return this._chatSnapshotGen!==this._chatGen&&(this._chatSnapshot=this.chatMessages.slice(),this._chatSnapshotGen=this._chatGen),{chatMessages:this._chatSnapshot,audioEvents:this.audioEvents.filter(t=>t.timeSec>e-.5&&t.timeSec<=e)}}},as=D(`liveStreaming`),os=class extends is{packetParser;relay;currentTimeSec=0;connectSynced=!1;_snapshot=null;_snapshotTick=-1;_ready=!1;_teamScoresGen=0;_rosterGen=0;_weaponsHudGen=0;_inventoryHudGen=0;_cachedHud=null;dataBlockClassNames=new Map;onReady;onMissionChange;missionName=null;lastMoveAck=0;constructor(e){super(),this.relay=e;let{registry:t,ghostTracker:n,packetParser:r}=Ba();this.packetParser=r,this.ghostTracker=n,this.registry=t}getDataBlockData(e){return this.packetParser.getDataBlockDataMap()?.get(e)}_shapeConstructorCache=null;getShapeConstructorSequences(e){this._shapeConstructorCache=new Map;let t=this.packetParser.getDataBlockDataMap();if(t){for(let[,e]of t){let t=e.shape,n=e.sequences;t&&n&&this._shapeConstructorCache.set(t.toLowerCase(),n)}return this._shapeConstructorCache.get(e.toLowerCase())}}getTimeSec(){return this.currentTimeSec}getCameraYawPitch(e){return this.getAbsoluteRotation(e)??{yaw:0,pitch:0}}getEffectShapes(){let e=new Set,t=this.packetParser.getDataBlockDataMap();if(!t)return[];for(let[,n]of t){let r=n.explosion;if(r==null)continue;let i=t.get(r);i?.dtsFileName&&e.add(i.dtsFileName)}return[...e]}onTeamScoresChanged(){this._teamScoresGen++}onRosterChanged(){this._rosterGen++}onWeaponsHudChanged(){this._weaponsHudGen++}onInventoryHudChanged(){this._inventoryHudGen++}reset(){this.resetSharedState(),this.ghostTracker.clear?.(),this.currentTimeSec=0,this._snapshot=null,this._snapshotTick=-1,this._cachedHud=null,this.dataBlockClassNames.clear(),this.observerMode=`fly`,this.missionName=null}getSnapshot(){return this._snapshot&&this._snapshotTick===this.tickCount?this._snapshot:this.buildSnapshot()}stepToTime(e,t){return this.currentTimeSec=e,this.getSnapshot()}syncConnectSequence(e){if(this.connectSynced||e.length<1)return;this.connectSynced=!0;let t=e[0]>>1&1;this.packetParser.setConnectionProtocolState({lastSeqRecvdAtSend:Array(32).fill(0),lastSeqRecvd:0,highestAckedSeq:0,lastSendSeq:536870911,ackMask:0,connectSequence:t,lastRecvAckAck:0,connectionEstablished:!0})}feedPacket(e){this.syncConnectSequence(e),this.processPacket(e)}handleRelayCommands(e){if(e.type!==`RemoteCommandEvent`)return;let t=e.funcName;if(!t)return;let n=this.resolveNetString(t);if([`t2csri_pokeClient`,`t2csri_getChallengeChunk`,`t2csri_decryptChallenge`].includes(n)){let t=(e.args??[]).map(e=>this.resolveNetString(e)).filter(e=>e!==``);as.info(`auth event: %s %o`,n,t),this.relay.sendAuthEvent(n,t);return}let r=(e.args??[]).map(e=>this.resolveNetString(e));if(n===`MissionStartPhase1`){let e=r[0]??``,t=r[1]??null;as.info(`mission phase 1, seq=%s mission=%s resolvedArgs=%o`,e,t,r),t&&t!==this.missionName&&(this.missionName=t,this.entities.clear(),this.entityIdByGhostIndex.clear(),this._ready=!1,this._snapshot=null,this._snapshotTick=-1,this._cachedHud=null,this.observerMode=`fly`,this.lastMoveAck=0,this.missionDisplayName=null,this.missionTypeDisplayName=null,this.gameClassName=null,this.serverDisplayName=null,this.onMissionChange?.(t)),this.relay.sendCommand(`MissionStartPhase1Done`,[e])}else if(n===`MissionStartPhase2`){let e=r[0]??``;as.info(`mission phase 2 (datablocks), seq=%s`,e),this.relay.sendCommand(`MissionStartPhase2Done`,[e])}else if(n===`MissionStartPhase3`){let e=r[0]??``,t=r[1]??null;as.info(`mission phase 3 (ghosting), seq=%s mission=%s`,e,t),t&&(this.missionName=t),this.relay.sendCommand(`setClientFav`,[``]),this.relay.sendCommand(`MissionStartPhase3Done`,[e])}}handleCRCChallenge(e){if(e.type!==`CRCChallengeEvent`)return;let t=e.crcValue,n=e.field1,r=e.field2,i=(n&1)!=0;as.info(`CRC challenge: seed=0x%s f1=0x%s f2=0x%s includeTextures=%s`,(t>>>0).toString(16),(n>>>0).toString(16),(r>>>0).toString(16),i);let a=this.packetParser.getDataBlockDataMap(),o=[];if(a)for(let[e,t]of a){let n=this.dataBlockClassNames.get(e);if(!n)continue;let r=K(n,t);o.push({objectId:e,className:n,shapeName:r??``})}as.info(`CRC: sending %d datablocks for computation`,o.length),this.relay.sendCRCCompute(t,r,o,i)}handleGhostingMessage(e){if(e.type!==`GhostingMessageEvent`)return;let t=e.message,n=e.sequence,r=e.ghostCount;as.info(`GhostingMessageEvent: message=%d sequence=%d ghostCount=%d`,t,n,r),t===0&&(as.info(`Sending ghost ack (type 1) for sequence %d`,n),this.relay.sendGhostAck(n,r))}observerMode=`fly`;requestScores(){this.relay.sendCommand(`getScores`,[])}getPlayerList(){let e=[];for(let[t,n]of this.targetNames){let r=this.targetTeams.get(t)??0;e.push({targetId:t,name:n,sensorGroup:r})}return e}processPacket(e){try{let t=this.packetParser.protocolRejected,n=this.packetParser.protocolNoDispatch,r=this.packetParser.parsePacket(e),i=this.packetParser.protocolRejected>t,a=this.packetParser.protocolNoDispatch>n;(i||a)&&as.warn(`packet #%d %s: %d bytes (total rejected=%d, noDispatch=%d)`,this.tickCount,i?`REJECTED`:`no-dispatch`,e.length,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch);let o=this.tickCount<20,s=this.tickCount%100==0,c=o||s;c&&as.debug(`packet #%d: %d events, %d ghosts, %d bytes%s%s`,this.tickCount,r.events.length,r.ghosts.length,e.length,r.gameState.controlObjectGhostIndex===void 0?``:`, control=${r.gameState.controlObjectGhostIndex}`,r.gameState.cameraFov===void 0?``:`, fov=${r.gameState.cameraFov}`),this.lastMoveAck=r.gameState.lastMoveAck,this.processControlObject(r.gameState);for(let e of r.events)if(e.parsedData){this.handleRelayCommands(e.parsedData),this.handleCRCChallenge(e.parsedData),this.handleGhostingMessage(e.parsedData);let t=e.parsedData.type;if(t===`RemoteCommandEvent`){let t=this.resolveNetString(e.parsedData.funcName??``);as.debug(`remote: %s`,t)}if(o&&t!==`NetStringEvent`&&t!==`RemoteCommandEvent`&&as.debug(`event: %s%s`,t,t===`SimDataBlockEvent`?` id=${e.parsedData.objectId} class=${e.parsedData.dataBlockClassName}`:``),t===`SimDataBlockEvent`){let t=e.parsedData.objectId,n=e.parsedData.dataBlockClassName;if(t!=null&&n&&this.dataBlockClassNames.set(t,n),c){let r=e.parsedData.dataBlockData,i=K(n??``,r);as.debug(`datablock: id=%d class=%s%s`,t,n??`?`,i?` shape=${i}`:``)}}let n=this.registry.getEventParser(e.classId)?.name;if(this.processEvent(e,n),o&&t===`NetStringEvent`){let t=e.parsedData.id,n=e.parsedData.value;t!=null&&typeof n==`string`&&as.trace(`netString #%d = "%s"`,t,n.length>60?n.slice(0,60)+`…`:n)}if(t===`TargetInfoEvent`){let t=e.parsedData.targetId,n=e.parsedData.nameTag;if(t!=null&&n!=null){let r=this.netStrings.get(n);if(r){let n=ho(r);as.info(`target #%d: "%s" team=%s`,t,n,e.parsedData.sensorGroup??`?`)}}}if(t===`SetSensorGroupEvent`){let t=e.parsedData.sensorGroup;t!=null&&as.info(`sensor group changed: → %d`,t)}if(t===`SensorGroupColorEvent`){let t=e.parsedData.sensorGroup,n=e.parsedData.colors;n&&as.debug(`sensor group colors: group=%d, %d entries`,t,n.length)}}for(let e of r.ghosts){if(e.type===`create`){let t=e.parsedData?.position,n=t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.z==`number`,r=this.resolveGhostClassName(e.index,e.classId);as.debug(`ghost create: #%d %s%s (%d entities total)`,e.index,r??`?`,n?` at (${t.x.toFixed(1)}, ${t.y.toFixed(1)}, ${t.z.toFixed(1)})`:``,this.entities.size+1),this._ready||(this._ready=!0,this.onReady?.())}else if(e.type===`delete`){let t=this.entityIdByGhostIndex.get(e.index),n=t?this.entities.get(t):void 0;(this.tickCount<50||this.tickCount%200==0)&&as.debug(`ghost delete: #%d %s (%d entities remaining)`,e.index,n?.className??`?`,this.entities.size-1)}this.processGhostUpdate(e)}if(this.tickCount++,this.advanceProjectiles(),this.advanceItems(),s&&this.tickCount>1){let e=this.packetParser.getDataBlockDataMap();as.info(`status @ tick %d: %d entities, %d datablocks, rejected=%d, noDispatch=%d`,this.tickCount,this.entities.size,e?.size??0,this.packetParser.protocolRejected,this.packetParser.protocolNoDispatch)}let l=this.entities.size;if(this.tickCount===1||l>0&&l%25==0&&this.tickCount<100){let e=new Map;for(let t of this.entities.values())e.set(t.type,(e.get(t.type)??0)+1);let t=[...e.entries()].map(([e,t])=>`${e}=${t}`).join(` `);as.info(`entity count: %d (%s)`,l,t)}let u=this.camera?.mode;if(this.updateCameraAndHud(),this.camera&&this.camera.mode!==u&&as.info(`camera mode: %s → %s%s`,u??`none`,this.camera.mode,this.camera.mode===`third-person`?` orbit=${this.camera.orbitTargetId??`?`} dist=${this.camera.orbitDistance??`?`}`:``),this.tickCount<=5&&this.camera){let[e,t,n]=this.camera.position;as.debug(`camera: mode=%s pos=(%s, %s, %s) fov=%s`,this.camera.mode,e.toFixed(1),t.toFixed(1),n.toFixed(1),this.camera.fov)}}catch(t){let n={tickCount:this.tickCount,entityCount:this.entities.size,dataLength:e.length,controlGhost:this.latestControl.ghostIndex,connectSynced:this.connectSynced};as.error(`Failed to process live packet: %o %o`,t,n)}}buildSnapshot(){let e=this.buildEntityList(),t=this.currentTimeSec,{chatMessages:n,audioEvents:r}=this.buildTimeFilteredEvents(t),i=this._cachedHud,a,o,s,c,l;i&&i.weaponsHudGen===this._weaponsHudGen&&i.inventoryHudGen===this._inventoryHudGen&&i.teamScoresGen===this._teamScoresGen&&i.rosterGen===this._rosterGen&&i.backpackPackIndex===this.backpackHud.packIndex&&i.backpackActive===this.backpackHud.active?(a=i.weaponsHud,o=i.inventoryHud,s=i.backpackHud,c=i.teamScores,l=i.playerRoster):({weaponsHud:a,inventoryHud:o,backpackHud:s,teamScores:c,playerRoster:l}=this.buildHudState(),this._cachedHud={weaponsHudGen:this._weaponsHudGen,inventoryHudGen:this._inventoryHudGen,teamScoresGen:this._teamScoresGen,rosterGen:this._rosterGen,backpackPackIndex:this.backpackHud.packIndex,backpackActive:this.backpackHud.active,weaponsHud:a,inventoryHud:o,backpackHud:s,teamScores:c,playerRoster:l}),this.camera||={time:t,position:[0,0,200],rotation:[0,0,0,1],fov:90,mode:`observer`};let u={timeSec:t,exhausted:!1,camera:this.camera,entities:e,controlPlayerGhostId:this.controlPlayerGhostId,playerSensorGroup:this.playerSensorGroup,status:this.lastStatus,chatMessages:n,audioEvents:r,weaponsHud:a,backpackHud:s,inventoryHud:o,teamScores:c,playerRoster:l,connectedClientId:this.connectedClientId,matchClockMs:this.computeMatchClockMs(t)};return this._snapshot=u,this._snapshotTick=this.tickCount,u}},ss=O()(e=>({missionEntities:new Map,streamEntities:new Map,isStreaming:!1,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:0,setEntity(t){e(e=>{let n=new Map(e.missionEntities);return n.set(t.id,t),{missionEntities:n,version:e.version+1}})},deleteEntity(t){e(e=>{if(!e.missionEntities.has(t))return e;let n=new Map(e.missionEntities);return n.delete(t),{missionEntities:n,version:e.version+1}})},setEntities(t){e(e=>{let n=new Map(e.missionEntities);for(let e of t)n.set(e.id,e);return{missionEntities:n,version:e.version+1}})},setAllEntities(t){e(e=>{let n=new Map;for(let e of t)n.set(e.id,e);return{missionEntities:n,dataSource:e.isStreaming?e.dataSource:`map`}})},clearEntities(){e(e=>e.missionEntities.size===0?e:e.isStreaming?{missionEntities:new Map,version:e.version+1}:{missionEntities:new Map,dataSource:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1})},setMissionInfo(t){let n={};if(t.missionName!==void 0&&(n.missionName=t.missionName),t.missionType!==void 0&&(n.missionType=t.missionType),t.missionTypeDisplayName!==void 0&&(n.missionTypeDisplayName=t.missionTypeDisplayName),t.missionDisplayName!==void 0&&(n.missionDisplayName=t.missionDisplayName),t.gameClassName!==void 0&&(n.gameClassName=t.gameClassName,t.missionType===void 0))if(t.gameClassName){let e=t.gameClassName.replace(/Game$/i,``);n.missionType=P[e.toLowerCase()]??e}else n.missionType=null;t.serverDisplayName!==void 0&&(n.serverDisplayName=t.serverDisplayName),t.recorderName!==void 0&&(n.recorderName=t.recorderName),t.recordingDate!==void 0&&(n.recordingDate=t.recordingDate),e(e=>({...n,version:e.version+1}))},beginStreaming(t){e(e=>({isStreaming:!0,dataSource:t,streamEntities:new Map,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,version:e.version+1}))},endStreaming(){e(e=>e.isStreaming?{isStreaming:!1,dataSource:e.missionEntities.size>0?`map`:null,missionName:null,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null,serverDisplayName:null,recorderName:null,recordingDate:null,streamEntities:new Map,version:e.version+1}:e)},setStreamEntity(t){e(e=>{let n=new Map(e.streamEntities);return n.set(t.id,t),{streamEntities:n,version:e.version+1}})},deleteStreamEntity(t){e(e=>{if(!e.streamEntities.has(t))return e;let n=new Map(e.streamEntities);return n.delete(t),{streamEntities:n,version:e.version+1}})},setStreamEntities(t){e(e=>{let n=new Map(e.streamEntities);for(let e of t)n.set(e.id,e);return{streamEntities:n,version:e.version+1}})},setAllStreamEntities(t){e(e=>{let n=new Map;for(let e of t)n.set(e.id,e);let r=e.streamEntities;return n.size===r.size&&[...n.keys()].every(e=>r.has(e))?e:{streamEntities:n,version:e.version+1}})},clearStreamEntities(){e(e=>e.streamEntities.size===0?e:{streamEntities:new Map,version:e.version+1})}}));function cs(e){let t=e.isStreaming?e.streamEntities:e.missionEntities,n=[];for(let e of t.values())e.renderType!==`None`&&n.push(e);return n}function ls(e,t){if(e.length!==t.length)return!1;for(let n=0;n({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,servers:[],serversLoading:!1,adapter:null,liveReady:!1,_relay:null,_adapter:null,_pending:[],_listInFlight:!1,connectRelay(n=Ms){let r=t();r._relay&&r._relay.close();let i=new zt(n,{onOpen(){e({relayConnected:!0});let n=t();for(let e of n._pending)e();n._pending=[]},onStatus(t,n,r,i){js.info(`game status: %s%s%s`,t,n?` — ${n}`:``,i?` map=${i}`:``),e({gameStatus:t,gameStatusMessage:n,...i?{mapName:i}:{}})},onServerList(n){t()._listInFlight=!1,e({servers:n,serversLoading:!1})},onGamePacket(e){let n=t()._adapter;n||js.warn(`received game packet but no adapter is active`),n?.feedPacket(e)},onPing(t){e({relayToGameServerPing:t})},onWsPing(t){e({browserToRelayPing:t})},onError(n){js.error(`error: %s`,n),t()._listInFlight=!1,e({serversLoading:!1})},onClose(){let n=t();n._relay===i&&(n._relay=null,n._adapter=null,n._pending=[],n._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1}))}});i.connect(),t()._relay=i},disconnectRelay(){let n=t();n._relay?.close(),n._relay=null,n._adapter=null,n._pending=[],n._listInFlight=!1,e({relayConnected:!1,gameStatus:null,gameStatusMessage:void 0,mapName:void 0,serverName:void 0,relayToGameServerPing:null,browserToRelayPing:null,adapter:null,liveReady:!1})},listServers(){let n=t();if(n._listInFlight)return;n._listInFlight=!0;let r=()=>{let e=t();e._relay?.sendWsPing(),e._relay?.listServers()};e({serversLoading:!0}),n._relay?.connected?r():(n._pending.push(r),n._relay||t().connectRelay())},joinServer(n,r){let i=t();if(!i._relay)return;let a=i.servers.find(e=>e.address===n),o=new os(i._relay);o.onReady=()=>e({liveReady:!0}),o.onMissionChange=t=>{js.info(`mission changed: %s`,t),e({mapName:t,liveReady:!1}),ss.getState().setMissionInfo({missionName:t,missionType:null,missionTypeDisplayName:null,missionDisplayName:null,gameClassName:null})},o.onMissionInfoChange=()=>{ss.getState().setMissionInfo({missionDisplayName:o.missionDisplayName??void 0,missionTypeDisplayName:o.missionTypeDisplayName??void 0,gameClassName:o.gameClassName??void 0,serverDisplayName:o.serverDisplayName??void 0,recorderName:o.connectedPlayerName??void 0})},i._adapter=o,e({mapName:a?.mapName??i.mapName,serverName:a?.name,warriorName:r,liveReady:!1,gameStatus:null,adapter:o}),ss.getState().setMissionInfo({missionName:a?.mapName??void 0,missionTypeDisplayName:a?.gameType??void 0,serverDisplayName:a?.name??void 0,recorderName:r??void 0}),i._relay.joinServer(n,r)},disconnectServer(){t().disconnectRelay()},sendMoves(e,n){t()._relay?.sendMoves(e,n)},sendCommand(e,...n){t()._relay?.sendCommand(e,n)}}));function Ps(e,t){return k(Ns,e,t)}function Fs(e){return e.relayToGameServerPing!=null&&e.browserToRelayPing!=null?e.relayToGameServerPing+e.browserToRelayPing:e.relayToGameServerPing??null}function Is(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(U.Fragment,{children:n}),t[0]=n,t[1]=r),r}function Ls(){return F(Rs)}function Rs(e){return e.playback.recording}function zs(){return F(Bs)}function Bs(e){return e.playback.status===`playing`}function Vs(){return F(Hs)}function Hs(e){return e.playback.timeMs/1e3}function Us(){return F(Ws)}function Ws(e){return e.playback.durationMs/1e3}function Gs(){return F(Ks)}function Ks(e){return e.playback.rate}function qs(){let e=(0,H.c)(17),t=Ls(),n=F(Zs),r=F(Xs),i=F(Ys),a=F(Js),o;e[0]===n?o=e[1]:(o=e=>{n(e)},e[0]=n,e[1]=o);let s=o,c;e[2]!==t||e[3]!==r?(c=()=>{t&&r(`playing`)},e[2]=t,e[3]=r,e[4]=c):c=e[4];let l=c,u;e[5]===r?u=e[6]:(u=()=>{r(`paused`)},e[5]=r,e[6]=u);let d=u,f;e[7]===i?f=e[8]:(f=e=>{i(e*1e3)},e[7]=i,e[8]=f);let p=f,m;e[9]===a?m=e[10]:(m=e=>{a(e)},e[9]=a,e[10]=m);let h=m,g;return e[11]!==d||e[12]!==l||e[13]!==p||e[14]!==s||e[15]!==h?(g={setRecording:s,play:l,pause:d,seek:p,setSpeed:h},e[11]=d,e[12]=l,e[13]=p,e[14]=s,e[15]=h,e[16]=g):g=e[16],g}function Js(e){return e.setPlaybackRate}function Ys(e){return e.setPlaybackTime}function Xs(e){return e.setPlaybackStatus}function Zs(e){return e.setRecording}var Qs={Root:`_Root_bhobl_1 _IconButton_1ypaz_23 _LabelledButton_1ypaz_68`,ButtonLabel:`_ButtonLabel_bhobl_6 _ButtonLabel_1ypaz_244`,ButtonHint:`_ButtonHint_bhobl_10 _ButtonHint_1ypaz_248`,DemoIcon:`_DemoIcon_bhobl_14`},$s=D(`LoadDemoButton`);function ec({isActive:e=!1,choosingMap:t=!1,onCancelChoosingMap:n}){let r=Ls()?.source===`demo`,{setRecording:i}=qs(),a=(0,V.useRef)(null),o=(0,V.useRef)(0),s=(0,V.useCallback)(()=>{if(t&&r){n?.();return}if(r){o.current+=1,i(null);return}a.current?.click()},[r,t,n,i]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{ref:a,type:`file`,accept:`.rec`,style:{display:`none`},onChange:(0,V.useCallback)(async e=>{let t=e.target.files?.[0];if(t){e.target.value=``;try{let e=await t.arrayBuffer(),n=o.current+1;o.current=n;let{createDemoStreamingRecording:r}=await I(async()=>{let{createDemoStreamingRecording:e}=await import(`./demoStreaming-DmedD6mI.js`);return{createDemoStreamingRecording:e}},__vite__mapDeps([0,1,2])),a=await r(e);if(o.current!==n)return;Ns.getState().disconnectServer(),i(a)}catch(e){$s.error(`Failed to load demo: %o`,e)}}},[i])}),(0,U.jsxs)(`button`,{type:`button`,className:Qs.Root,"aria-label":r?`Unload demo`:`Load demo (.rec)`,title:r?`Unload demo`:`Load demo (.rec)`,onClick:s,"data-active":e,children:[(0,U.jsx)(Lt,{className:Qs.DemoIcon}),(0,U.jsx)(`span`,{className:Qs.ButtonLabel,children:`Demo`}),(0,U.jsx)(`span`,{className:Qs.ButtonHint,children:t&&r?`Return to demo`:r?`Click to unload`:`Load a .rec file`})]})]})}function tc(e){return S({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 nc={Root:`_Root_1qu11_1 _IconButton_1ypaz_23 _LabelledButton_1ypaz_68`,TextLabel:`_TextLabel_1qu11_6 _ButtonLabel_1ypaz_244`,PingLabel:`_PingLabel_1qu11_10 _ButtonLabel_1ypaz_244`,LiveIcon:`_LiveIcon_1qu11_15`,Pulsing:`_Pulsing_1qu11_18`,blink:`_blink_1qu11_1`,ButtonHint:`_ButtonHint_1qu11_30 _ButtonHint_1ypaz_248`};function rc(e){return`${e.toLocaleString()} ms`}function ic(e){let t=(0,H.c)(19),{isActive:n,onOpenServerBrowser:r}=e,i=Ps(oc),a=Ps(Fs),o=Ps(ac),s=i===`connected`,c=i===`connecting`||i===`challenging`||i===`authenticating`,l=s?`Connected –\xA0click to disconnect`:`Join server`,u=s?`Connected –\xA0click to disconnect`:`Join server`,d;t[0]!==o||t[1]!==s||t[2]!==r?(d=()=>{s?o():r()},t[0]=o,t[1]=s,t[2]=r,t[3]=d):d=t[3];let f=`${nc.LiveIcon} ${s?nc.Pulsing:``}`,p;t[4]===f?p=t[5]:(p=(0,U.jsx)(tc,{className:f}),t[4]=f,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(`span`,{className:nc.TextLabel,children:`Live`}),t[6]=m):m=t[6];let h;t[7]!==c||t[8]!==a?(h=c?`Connecting…`:a==null?`Join a game`:rc(a),t[7]=c,t[8]=a,t[9]=h):h=t[9];let g;t[10]===h?g=t[11]:(g=(0,U.jsxs)(U.Fragment,{children:[m,(0,U.jsx)(`span`,{className:nc.ButtonHint,children:h})]}),t[10]=h,t[11]=g);let _;return t[12]!==n||t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p||t[17]!==g?(_=(0,U.jsxs)(`button`,{type:`button`,className:nc.Root,"aria-label":l,title:u,onClick:d,"data-active":n,children:[p,g]}),t[12]=n,t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=g,t[18]=_):_=t[18],_}function ac(e){return e.disconnectServer}function oc(e){return e.gameStatus}function sc(e,t=[]){let n=[];function r(t,r){let i=V.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=V.useMemo(()=>o,Object.values(o));return(0,U.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=V.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>V.createContext(e));return function(n){let r=n?.[e]||t;return V.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,cc(i,...t)]}function cc(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function lc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function uc(...e){return t=>{let n=!1,r=e.map(e=>{let r=lc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:r,...i}=e,a=V.Children.toArray(r),o=a.find(hc);if(o){let e=o.props.children,r=a.map(t=>t===o?V.Children.count(e)>1?V.Children.only(null):V.isValidElement(e)?e.props.children:null:t);return(0,U.jsx)(t,{...i,ref:n,children:V.isValidElement(e)?V.cloneElement(e,void 0,r):null})}return(0,U.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function pc(e){let t=V.forwardRef((e,t)=>{let{children:n,...r}=e;if(V.isValidElement(n)){let e=_c(n),i=gc(r,n.props);return n.type!==V.Fragment&&(i.ref=t?uc(t,e):e),V.cloneElement(n,i)}return V.Children.count(n)>1?V.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mc=Symbol(`radix.slottable`);function hc(e){return V.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===mc}function gc(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function _c(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function vc(e){let t=e+`CollectionProvider`,[n,r]=sc(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=V.useRef(null),a=V.useRef(new Map).current;return(0,U.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=fc(s),l=V.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,U.jsx)(c,{ref:dc(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=fc(u),p=V.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=V.useRef(null),s=dc(t,o),c=a(u,n);return V.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,U.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return V.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function yc(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var bc=globalThis?.document?V.useLayoutEffect:()=>{},xc=V.useInsertionEffect||bc;function Sc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Cc({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=V.useRef(e!==void 0);V.useEffect(()=>{let e=t.current;if(e!==s){let t=e?`controlled`:`uncontrolled`,n=s?`controlled`:`uncontrolled`;console.warn(`${r} is changing from ${t} to ${n}. 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,r])}return[c,V.useCallback(t=>{if(s){let n=wc(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Cc({defaultProp:e,onChange:t}){let[n,r]=V.useState(e),i=V.useRef(n),a=V.useRef(t);return xc(()=>{a.current=t},[t]),V.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function wc(e){return typeof e==`function`}var Tc=e(re(),1),Ec=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=fc(`Primitive.${t}`),r=V.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Dc(e,t){return V.useReducer((e,n)=>t[e][n]??e,e)}var Oc=e=>{let{present:t,children:n}=e,r=kc(t),i=typeof n==`function`?n({present:r.isPresent}):V.Children.only(n),a=dc(r.ref,jc(i));return typeof n==`function`||r.isPresent?V.cloneElement(i,{ref:a}):null};Oc.displayName=`Presence`;function kc(e){let[t,n]=V.useState(),r=V.useRef(null),i=V.useRef(e),a=V.useRef(`none`),[o,s]=Dc(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return V.useEffect(()=>{let e=Ac(r.current);a.current=o===`mounted`?e:`none`},[o]),bc(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Ac(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),bc(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Ac(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Ac(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:V.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Ac(e){return e?.animationName||`none`}function jc(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mc=V.useId||(()=>void 0),Nc=0;function Pc(e){let[t,n]=V.useState(Mc());return bc(()=>{e||n(e=>e??String(Nc++))},[e]),e||(t?`radix-${t}`:``)}var Fc=`Collapsible`,[Ic,Lc]=sc(Fc),[Rc,zc]=Ic(Fc),Bc=V.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=Sc({prop:r,defaultProp:i??!1,onChange:o,caller:Fc});return(0,U.jsx)(Rc,{scope:n,disabled:a,contentId:Pc(),open:c,onOpenToggle:V.useCallback(()=>l(e=>!e),[l]),children:(0,U.jsx)(Ec.div,{"data-state":Kc(c),"data-disabled":a?``:void 0,...s,ref:t})})});Bc.displayName=Fc;var Vc=`CollapsibleTrigger`,Hc=V.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=zc(Vc,n);return(0,U.jsx)(Ec.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Kc(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:yc(e.onClick,i.onOpenToggle)})});Hc.displayName=Vc;var Uc=`CollapsibleContent`,Wc=V.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=zc(Uc,e.__scopeCollapsible);return(0,U.jsx)(Oc,{present:n||i.open,children:({present:e})=>(0,U.jsx)(Gc,{...r,ref:t,present:e})})});Wc.displayName=Uc;var Gc=V.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=zc(Uc,n),[s,c]=V.useState(r),l=V.useRef(null),u=dc(t,l),d=V.useRef(0),f=d.current,p=V.useRef(0),m=p.current,h=o.open||s,g=V.useRef(h),_=V.useRef(void 0);return V.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),bc(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,U.jsx)(Ec.div,{"data-state":Kc(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function Kc(e){return e?`open`:`closed`}var qc=Bc,Jc=Hc,Yc=Wc,Xc=V.createContext(void 0);function Zc(e){let t=V.useContext(Xc);return e||t||`ltr`}var Qc=`Accordion`,$c=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[el,tl,nl]=vc(Qc),[rl,il]=sc(Qc,[nl,Lc]),al=Lc(),ol=V.forwardRef((e,t)=>{let{type:n,...r}=e,i=r,a=r;return(0,U.jsx)(el.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,U.jsx)(fl,{...a,ref:t}):(0,U.jsx)(dl,{...i,ref:t})})});ol.displayName=Qc;var[sl,cl]=rl(Qc),[ll,ul]=rl(Qc,{collapsible:!1}),dl=V.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:a=!1,...o}=e,[s,c]=Sc({prop:n,defaultProp:r??``,onChange:i,caller:Qc});return(0,U.jsx)(sl,{scope:e.__scopeAccordion,value:V.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:V.useCallback(()=>a&&c(``),[a,c]),children:(0,U.jsx)(ll,{scope:e.__scopeAccordion,collapsible:a,children:(0,U.jsx)(hl,{...o,ref:t})})})}),fl=V.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=Sc({prop:n,defaultProp:r??[],onChange:i,caller:Qc}),c=V.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=V.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,U.jsx)(sl,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,U.jsx)(ll,{scope:e.__scopeAccordion,collapsible:!0,children:(0,U.jsx)(hl,{...a,ref:t})})})}),[pl,ml]=rl(Qc),hl=V.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=dc(V.useRef(null),t),c=tl(n),l=Zc(i)===`ltr`,u=yc(e.onKeyDown,e=>{if(!$c.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=()=>{o=r+1,o>s&&(o=0)},d=()=>{o=r-1,o<0&&(o=s)};switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,U.jsx)(pl,{scope:n,disabled:r,direction:i,orientation:a,children:(0,U.jsx)(el.Slot,{scope:n,children:(0,U.jsx)(Ec.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})}),gl=`AccordionItem`,[_l,vl]=rl(gl),yl=V.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...i}=e,a=ml(gl,n),o=cl(gl,n),s=al(n),c=Pc(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,U.jsx)(_l,{scope:n,open:l,disabled:u,triggerId:c,children:(0,U.jsx)(qc,{"data-orientation":a.orientation,"data-state":El(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});yl.displayName=gl;var bl=`AccordionHeader`,xl=V.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ml(Qc,n),a=vl(bl,n);return(0,U.jsx)(Ec.h3,{"data-orientation":i.orientation,"data-state":El(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})});xl.displayName=bl;var Sl=`AccordionTrigger`,Cl=V.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ml(Qc,n),a=vl(Sl,n),o=ul(Sl,n),s=al(n);return(0,U.jsx)(el.ItemSlot,{scope:n,children:(0,U.jsx)(Jc,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})});Cl.displayName=Sl;var wl=`AccordionContent`,Tl=V.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,i=ml(Qc,n),a=vl(wl,n),o=al(n);return(0,U.jsx)(Yc,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})});Tl.displayName=wl;function El(e){return e?`open`:`closed`}var Dl=ol,Ol=yl,kl=Cl,Al=Tl;function jl(e){return S({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)}var Ml={AccordionGroup:`_AccordionGroup_1kmjc_1`,Trigger:`_Trigger_1kmjc_7`,TriggerIcon:`_TriggerIcon_1kmjc_24`,Content:`_Content_1kmjc_35`,slideDown:`_slideDown_1kmjc_1`,slideUp:`_slideUp_1kmjc_1`,Body:`_Body_1kmjc_47`};function Nl(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,U.jsx)(Dl,{className:Ml.AccordionGroup,...e}),t[0]=e,t[1]=n),n}function Pl(e){let t=(0,H.c)(9),{value:n,label:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(jl,{className:Ml.TriggerIcon}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,U.jsxs)(kl,{className:Ml.Trigger,children:[a,` `,r]}),t[1]=r,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,U.jsx)(Al,{className:Ml.Content,children:(0,U.jsx)(`div`,{className:Ml.Body,children:i})}),t[3]=i,t[4]=s);let c;return t[5]!==o||t[6]!==s||t[7]!==n?(c=(0,U.jsxs)(Ol,{value:n,children:[o,s]}),t[5]=o,t[6]=s,t[7]=n,t[8]=c):c=t[8],c}var q={InspectorControls:`_InspectorControls_1ypaz_1`,Dropdown:`_Dropdown_1ypaz_8`,ButtonGroup:`_ButtonGroup_1ypaz_16`,IconButton:`_IconButton_1ypaz_23`,Group:`_Group_1ypaz_60`,LabelledButton:`_LabelledButton_1ypaz_68`,CheckboxField:`_CheckboxField_1ypaz_74`,Description:`_Description_1ypaz_83`,Label:`_Label_1ypaz_68`,Control:`_Control_1ypaz_118`,Field:`_Field_1ypaz_87`,Tools:`_Tools_1ypaz_132`,ButtonLabel:`_ButtonLabel_1ypaz_244`,ButtonHint:`_ButtonHint_1ypaz_248`,Toggle:`_Toggle_1ypaz_253 _IconButton_1ypaz_23`,MapInfoButton:`_MapInfoButton_1ypaz_258 _IconButton_1ypaz_23 _LabelledButton_1ypaz_68`,ForceRenderButton:`_ForceRenderButton_1ypaz_263`},Fl=[`controls`,`preferences`,`audio`],Il=(0,V.memo)(function(e){let t=(0,H.c)(177),{missionName:n,missionType:r,onOpenMapInfo:i,onOpenScoreScreen:a,onOpenServerBrowser:o,onChooseMap:s,onCancelChoosingMap:l,choosingMap:u,cameraRef:d,invalidateRef:p}=e,m=g(),h=hs(),_=Ls(),y=_s(),b=h===`demo`||h===`live`?y:n,x;t[0]===b?x=t[1]:(x=b?C(b):!1,t[0]=b,t[1]=x);let S=x,w=Ps(Ll),{fogEnabled:T,setFogEnabled:E,fov:D,setFov:O,audioEnabled:k,setAudioEnabled:A,audioVolume:j,setAudioVolume:M,animationEnabled:ee,setAnimationEnabled:N}=c(),{speedMultiplier:P,setSpeedMultiplier:F,mouseSensitivity:te,setMouseSensitivity:I,touchMode:ne,setTouchMode:L,invertScroll:R,setInvertScroll:re,invertDrag:z,setInvertDrag:B,invertJoystick:ie,setInvertJoystick:ae}=v(),{debugMode:oe,setDebugMode:se,renderOnDemand:ce,setRenderOnDemand:le}=f(),[ue,de]=(0,V.useState)(!1),fe=(0,V.useRef)(null),pe=(0,V.useRef)(null),me=(0,V.useRef)(null),he,ge;t[2]===ue?(he=t[3],ge=t[4]):(he=()=>{ue&&fe.current?.focus()},ge=[ue],t[2]=ue,t[3]=he,t[4]=ge),(0,V.useEffect)(he,ge);let _e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{let t=e.relatedTarget;t&&me.current?.contains(t)||de(!1)},t[5]=_e):_e=t[5];let ve=_e,ye;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(ye=e=>{e.key===`Escape`&&(de(!1),pe.current?.focus())},t[6]=ye):ye=t[6];let be=ye,xe=h===`map`&&!_||u,Se,Ce,we;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,U.jsx)(xt,{}),Ce=(0,U.jsx)(`span`,{className:q.ButtonLabel,children:`Explore`}),we=(0,U.jsx)(`span`,{className:q.ButtonHint,children:`Browse maps`}),t[7]=Se,t[8]=Ce,t[9]=we):(Se=t[7],Ce=t[8],we=t[9]);let Te;t[10]!==s||t[11]!==xe?(Te=(0,U.jsxs)(`button`,{type:`button`,className:q.IconButton,"data-active":xe,onClick:s,children:[Se,Ce,we]}),t[10]=s,t[11]=xe,t[12]=Te):Te=t[12];let Ee=!u&&_?.source===`demo`,De;t[13]!==u||t[14]!==l||t[15]!==Ee?(De=(0,U.jsx)(ec,{isActive:Ee,choosingMap:u,onCancelChoosingMap:l}),t[13]=u,t[14]=l,t[15]=Ee,t[16]=De):De=t[16];let Oe;t[17]!==u||t[18]!==w||t[19]!==o?(Oe=o&&(0,U.jsx)(ic,{isActive:!u&&w,onOpenServerBrowser:o}),t[17]=u,t[18]=w,t[19]=o,t[20]=Oe):Oe=t[20];let ke;t[21]!==Te||t[22]!==De||t[23]!==Oe?(ke=(0,U.jsxs)(`div`,{className:q.ButtonGroup,children:[Te,De,Oe]}),t[21]=Te,t[22]=De,t[23]=Oe,t[24]=ke):ke=t[24];let Ae=!S,je;t[25]!==d||t[26]!==n||t[27]!==r||t[28]!==Ae?(je=(0,U.jsx)(It,{missionName:n,missionType:r,cameraRef:d,disabled:Ae}),t[25]=d,t[26]=n,t[27]=r,t[28]=Ae,t[29]=je):je=t[29];let Me=!S,Ne,Pe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,U.jsx)(kt,{}),Pe=(0,U.jsx)(`span`,{className:q.ButtonLabel,children:`Show map info`}),t[30]=Ne,t[31]=Pe):(Ne=t[30],Pe=t[31]);let Fe;t[32]!==i||t[33]!==Me?(Fe=(0,U.jsxs)(`button`,{type:`button`,className:q.MapInfoButton,"aria-label":`Show map info`,onClick:i,disabled:Me,children:[Ne,Pe]}),t[32]=i,t[33]=Me,t[34]=Fe):Fe=t[34];let Ie;t[35]===a?Ie=t[36]:(Ie=a&&(0,U.jsxs)(`button`,{type:`button`,className:q.MapInfoButton,"aria-label":`Show scores`,onClick:a,children:[(0,U.jsx)(wt,{}),(0,U.jsx)(`span`,{className:q.ButtonLabel,children:`Show scores`})]}),t[35]=a,t[36]=Ie);let Le;t[37]!==ke||t[38]!==je||t[39]!==Fe||t[40]!==Ie?(Le=(0,U.jsxs)(`div`,{className:q.Tools,children:[ke,je,Fe,Ie]}),t[37]=ke,t[38]=je,t[39]=Fe,t[40]=Ie,t[41]=Le):Le=t[41];let Re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,U.jsx)(`label`,{htmlFor:`speedInput`,children:`Fly speed`}),t[42]=Re):Re=t[42];let ze;t[43]===P?ze=t[44]:(ze=Math.round(P*100),t[43]=P,t[44]=ze);let Be;t[45]===F?Be=t[46]:(Be=e=>F(parseFloat(e.target.value)/100),t[45]=F,t[46]=Be);let Ve;t[47]!==ze||t[48]!==Be?(Ve=(0,U.jsx)(`input`,{id:`speedInput`,type:`range`,min:1,max:100,step:1,value:ze,onChange:Be}),t[47]=ze,t[48]=Be,t[49]=Ve):Ve=t[49];let He=m===!1?` Use your scroll wheel or trackpad to adjust while flying.`:``,Ue;t[50]===He?Ue=t[51]:(Ue=(0,U.jsxs)(`p`,{className:q.Description,children:[`How fast you move in free-flying mode.`,He]}),t[50]=He,t[51]=Ue);let We;t[52]!==Ve||t[53]!==Ue?(We=(0,U.jsxs)(`div`,{className:q.Field,children:[Re,Ve,Ue]}),t[52]=Ve,t[53]=Ue,t[54]=We):We=t[54];let Ge;t[55]!==m||t[56]!==L||t[57]!==ne?(Ge=m?(0,U.jsxs)(`div`,{className:q.Field,children:[(0,U.jsx)(`label`,{htmlFor:`touchModeInput`,children:`Joystick`}),` `,(0,U.jsxs)(`select`,{id:`touchModeInput`,value:ne,onChange:e=>L(e.target.value),children:[(0,U.jsx)(`option`,{value:`dualStick`,children:`Dual stick`}),(0,U.jsx)(`option`,{value:`moveLookStick`,children:`Single stick`})]}),(0,U.jsx)(`p`,{className:q.Description,children:`Single stick has a unified move + look control. Dual stick has independent move + look.`})]}):null,t[55]=m,t[56]=L,t[57]=ne,t[58]=Ge):Ge=t[58];let Ke;t[59]!==R||t[60]!==m||t[61]!==re?(Ke=m===!1?(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[(0,U.jsx)(`input`,{id:`invertScroll`,type:`checkbox`,checked:R,onChange:e=>{re(e.target.checked)}}),(0,U.jsx)(`label`,{className:q.Label,htmlFor:`invertScroll`,children:`Invert scroll direction`}),(0,U.jsx)(`p`,{className:q.Description,children:`Reverse which scroll direction increases and decreases fly speed.`})]}):null,t[59]=R,t[60]=m,t[61]=re,t[62]=Ke):Ke=t[62];let qe;t[63]!==ie||t[64]!==m||t[65]!==ae?(qe=m?(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[(0,U.jsx)(`input`,{id:`invertJoystick`,type:`checkbox`,checked:ie,onChange:e=>{ae(e.target.checked)}}),(0,U.jsx)(`label`,{className:q.Label,htmlFor:`invertJoystick`,children:`Invert joystick direction`}),(0,U.jsx)(`p`,{className:q.Description,children:`Reverse joystick look direction.`})]}):null,t[63]=ie,t[64]=m,t[65]=ae,t[66]=qe):qe=t[66];let Je;t[67]===B?Je=t[68]:(Je=e=>{B(e.target.checked)},t[67]=B,t[68]=Je);let Ye;t[69]!==z||t[70]!==Je?(Ye=(0,U.jsx)(`input`,{id:`invertDrag`,type:`checkbox`,checked:z,onChange:Je}),t[69]=z,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe,Ze;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,U.jsx)(`label`,{className:q.Label,htmlFor:`invertDrag`,children:`Invert drag direction`}),Ze=(0,U.jsx)(`p`,{className:q.Description,children:`Reverse how dragging the viewport aims the camera.`}),t[72]=Xe,t[73]=Ze):(Xe=t[72],Ze=t[73]);let Qe;t[74]===Ye?Qe=t[75]:(Qe=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[Ye,Xe,Ze]}),t[74]=Ye,t[75]=Qe);let $e;t[76]!==m||t[77]!==te||t[78]!==I?($e=m===!1&&(0,U.jsxs)(`div`,{className:q.Field,children:[(0,U.jsx)(`label`,{htmlFor:`mouseSensitivityInput`,children:`Mouse sensitivity`}),(0,U.jsx)(`div`,{className:q.Control,children:(0,U.jsx)(`input`,{id:`mouseSensitivityInput`,type:`range`,min:1,max:256,step:2,value:Math.round(te*16e3),onChange:e=>{I(parseInt(e.target.value)/16e3)}})})]}),t[76]=m,t[77]=te,t[78]=I,t[79]=$e):$e=t[79];let et;t[80]!==We||t[81]!==Ge||t[82]!==Ke||t[83]!==qe||t[84]!==Qe||t[85]!==$e?(et=(0,U.jsxs)(Pl,{value:`controls`,label:`Controls`,children:[We,Ge,Ke,qe,Qe,$e]}),t[80]=We,t[81]=Ge,t[82]=Ke,t[83]=qe,t[84]=Qe,t[85]=$e,t[86]=et):et=t[86];let tt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,U.jsx)(`label`,{htmlFor:`fovInput`,children:`FOV`}),t[87]=tt):tt=t[87];let nt;t[88]===D?nt=t[89]:(nt=(0,U.jsxs)(`output`,{htmlFor:`fovInput`,children:[D,`°`]}),t[88]=D,t[89]=nt);let rt;t[90]===O?rt=t[91]:(rt=e=>O(parseInt(e.target.value)),t[90]=O,t[91]=rt);let it;t[92]!==D||t[93]!==rt?(it=(0,U.jsx)(`input`,{id:`fovInput`,type:`range`,min:75,max:120,step:5,value:D,onChange:rt}),t[92]=D,t[93]=rt,t[94]=it):it=t[94];let at;t[95]!==nt||t[96]!==it?(at=(0,U.jsx)(Pl,{value:`preferences`,label:`Preferences`,children:(0,U.jsxs)(`div`,{className:q.Field,children:[tt,(0,U.jsxs)(`div`,{className:q.Control,children:[nt,it]})]})}),t[95]=nt,t[96]=it,t[97]=at):at=t[97];let ot;t[98]===A?ot=t[99]:(ot=e=>{A(e.target.checked)},t[98]=A,t[99]=ot);let st;t[100]!==k||t[101]!==ot?(st=(0,U.jsx)(`input`,{id:`audioInput`,type:`checkbox`,checked:k,onChange:ot}),t[100]=k,t[101]=ot,t[102]=st):st=t[102];let ct;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,U.jsx)(`label`,{className:q.Label,htmlFor:`audioInput`,children:`Enable audio`}),t[103]=ct):ct=t[103];let lt;t[104]===st?lt=t[105]:(lt=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[st,ct]}),t[104]=st,t[105]=lt);let ut;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,U.jsx)(`label`,{htmlFor:`volumeInput`,children:`Master volume`}),t[106]=ut):ut=t[106];let dt;t[107]===j?dt=t[108]:(dt=Math.round(j*100),t[107]=j,t[108]=dt);let ft;t[109]===dt?ft=t[110]:(ft=(0,U.jsxs)(`output`,{htmlFor:`volumeInput`,children:[dt,`%`]}),t[109]=dt,t[110]=ft);let pt;t[111]===M?pt=t[112]:(pt=e=>M(parseFloat(e.target.value)),t[111]=M,t[112]=pt);let mt;t[113]!==j||t[114]!==pt?(mt=(0,U.jsx)(`input`,{id:`volumeInput`,type:`range`,min:0,max:1,step:.05,value:j,onChange:pt}),t[113]=j,t[114]=pt,t[115]=mt):mt=t[115];let ht;t[116]!==ft||t[117]!==mt?(ht=(0,U.jsxs)(`div`,{className:q.Field,children:[ut,(0,U.jsxs)(`div`,{className:q.Control,children:[ft,mt]})]}),t[116]=ft,t[117]=mt,t[118]=ht):ht=t[118];let gt;t[119]!==lt||t[120]!==ht?(gt=(0,U.jsxs)(Pl,{value:`audio`,label:`Audio`,children:[lt,ht]}),t[119]=lt,t[120]=ht,t[121]=gt):gt=t[121];let _t;t[122]===E?_t=t[123]:(_t=e=>{E(e.target.checked)},t[122]=E,t[123]=_t);let vt;t[124]!==T||t[125]!==_t?(vt=(0,U.jsx)(`input`,{id:`fogInput`,type:`checkbox`,checked:T,onChange:_t}),t[124]=T,t[125]=_t,t[126]=vt):vt=t[126];let yt;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,U.jsx)(`label`,{className:q.Label,htmlFor:`fogInput`,children:`Enable fog`}),t[127]=yt):yt=t[127];let bt;t[128]===vt?bt=t[129]:(bt=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[vt,yt]}),t[128]=vt,t[129]=bt);let Ct;t[130]===N?Ct=t[131]:(Ct=e=>{N(e.target.checked)},t[130]=N,t[131]=Ct);let Tt;t[132]!==ee||t[133]!==Ct?(Tt=(0,U.jsx)(`input`,{id:`animationInput`,type:`checkbox`,checked:ee,onChange:Ct}),t[132]=ee,t[133]=Ct,t[134]=Tt):Tt=t[134];let Et;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,U.jsx)(`label`,{className:q.Label,htmlFor:`animationInput`,children:`Enable animations`}),t[135]=Et):Et=t[135];let Dt;t[136]===Tt?Dt=t[137]:(Dt=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[Tt,Et]}),t[136]=Tt,t[137]=Dt);let Ot;t[138]!==bt||t[139]!==Dt?(Ot=(0,U.jsxs)(Pl,{value:`graphics`,label:`Graphics`,children:[bt,Dt]}),t[138]=bt,t[139]=Dt,t[140]=Ot):Ot=t[140];let At;t[141]===se?At=t[142]:(At=e=>{se(e.target.checked)},t[141]=se,t[142]=At);let jt;t[143]!==oe||t[144]!==At?(jt=(0,U.jsx)(`input`,{id:`debugInput`,type:`checkbox`,checked:oe,onChange:At}),t[143]=oe,t[144]=At,t[145]=jt):jt=t[145];let Mt;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=(0,U.jsx)(`label`,{className:q.Label,htmlFor:`debugInput`,children:`Render debug visuals`}),t[146]=Mt):Mt=t[146];let Nt;t[147]===jt?Nt=t[148]:(Nt=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[jt,Mt]}),t[147]=jt,t[148]=Nt);let Pt;t[149]===le?Pt=t[150]:(Pt=e=>{le(e.target.checked)},t[149]=le,t[150]=Pt);let Ft;t[151]!==ce||t[152]!==Pt?(Ft=(0,U.jsx)(`input`,{id:`onDemandInput`,type:`checkbox`,checked:ce,onChange:Pt}),t[151]=ce,t[152]=Pt,t[153]=Ft):Ft=t[153];let Lt;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=(0,U.jsx)(`label`,{htmlFor:`onDemandInput`,children:`Render on demand `}),t[154]=Lt):Lt=t[154];let Rt;t[155]===p?Rt=t[156]:(Rt=()=>p.current?.(),t[155]=p,t[156]=Rt);let zt;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(zt=(0,U.jsx)(St,{}),t[157]=zt):zt=t[157];let Bt;t[158]===Rt?Bt=t[159]:(Bt=(0,U.jsxs)(`div`,{className:q.Label,children:[Lt,(0,U.jsx)(`button`,{type:`button`,className:q.ForceRenderButton,title:`Force render`,"aria-label":`Force render`,onClick:Rt,children:zt})]}),t[158]=Rt,t[159]=Bt);let Vt;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(Vt=(0,U.jsx)(`p`,{className:q.Description,children:`Significantly decreases CPU and GPU usage by only rendering frames when requested. Helpful when developing parts of the app unrelated to rendering.`}),t[160]=Vt):Vt=t[160];let Ht;t[161]!==Ft||t[162]!==Bt?(Ht=(0,U.jsxs)(`div`,{className:q.CheckboxField,children:[Ft,Bt,Vt]}),t[161]=Ft,t[162]=Bt,t[163]=Ht):Ht=t[163];let Ut;t[164]!==Nt||t[165]!==Ht?(Ut=(0,U.jsxs)(Pl,{value:`debug`,label:`Debug`,children:[Nt,Ht]}),t[164]=Nt,t[165]=Ht,t[166]=Ut):Ut=t[166];let Wt;t[167]!==et||t[168]!==at||t[169]!==gt||t[170]!==Ot||t[171]!==Ut?(Wt=(0,U.jsx)(`div`,{className:q.Accordions,children:(0,U.jsxs)(Nl,{type:`multiple`,defaultValue:Fl,children:[et,at,gt,Ot,Ut]})}),t[167]=et,t[168]=at,t[169]=gt,t[170]=Ot,t[171]=Ut,t[172]=Wt):Wt=t[172];let Gt;return t[173]!==ue||t[174]!==Le||t[175]!==Wt?(Gt=(0,U.jsx)(`div`,{className:q.InspectorControls,children:(0,U.jsx)(`div`,{ref:me,children:(0,U.jsxs)(`div`,{className:q.Dropdown,ref:fe,id:`settingsPanel`,tabIndex:-1,onKeyDown:be,onBlur:ve,"data-open":ue,children:[Le,Wt]})})}),t[173]=ue,t[174]=Le,t[175]=Wt,t[176]=Gt):Gt=t[176],Gt});function Ll(e){return e.gameStatus===`connected`||e.gameStatus===`authenticating`}function Rl(...e){}function J(e,t){return Y(e)?e(zl(t)?t():t):e}function Y(e){return typeof e==`function`}function zl(e){return typeof e==`function`}function Bl(e,t){return typeof Object.hasOwn==`function`?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function Vl(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Hl(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}function Ul(e,t){let n={...e};for(let e of t)Bl(n,e)&&delete n[e];return n}function Wl(e,t){let n={};for(let r of t)Bl(e,r)&&(n[r]=e[r]);return n}function Gl(e){return e}function Kl(e,t){if(!e)throw typeof t==`string`?Error(t):Error(`Invariant failed`)}function ql(e){return Object.keys(e)}function Jl(e,...t){let n=typeof e==`function`?e(...t):e;return n==null?!1:!n}function Yl(e){return e.disabled||e[`aria-disabled`]===!0||e[`aria-disabled`]===`true`}function Xl(e){let t={};for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function X(...e){for(let t of e)if(t!==void 0)return t}function Zl(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function Ql(e){return!e||!(0,V.isValidElement)(e)?!1:`ref`in e.props||`ref`in e}function $l(e){return Ql(e)?{...e.props}.ref||e.ref:null}function eu(e,t){let n={...e};for(let r in t){if(!Bl(t,r))continue;if(r===`className`){let r=`className`;n[r]=e[r]?`${e[r]} ${t[r]}`:t[r];continue}if(r===`style`){let r=`style`;n[r]=e[r]?{...e[r],...t[r]}:t[r];continue}let i=t[r];if(typeof i==`function`&&r.startsWith(`on`)){let t=e[r];if(typeof t==`function`){n[r]=(...e)=>{i(...e),t(...e)};continue}}n[r]=i}return n}var tu=nu();function nu(){return typeof window<`u`&&!!window.document?.createElement}function ru(e){return e?`self`in e?e.document:e.ownerDocument||document:document}function iu(e){return e?`self`in e?e.self:ru(e).defaultView||window:self}function au(e,t=!1){let{activeElement:n}=ru(e);if(!n?.nodeName)return null;if(su(n)&&n.contentDocument?.body)return au(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ru(n).getElementById(e);if(t)return t}}return n}function ou(e,t){return e===t||e.contains(t)}function su(e){return e.tagName===`IFRAME`}function cu(e){let t=e.tagName.toLowerCase();return t===`button`?!0:t===`input`&&e.type?lu.indexOf(e.type)!==-1:!1}var lu=[`button`,`color`,`file`,`image`,`reset`,`submit`];function uu(e){if(typeof e.checkVisibility==`function`)return e.checkVisibility();let t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}function du(e){try{let t=e instanceof HTMLInputElement&&e.selectionStart!==null,n=e.tagName===`TEXTAREA`;return t||n||!1}catch{return!1}}function fu(e){return e.isContentEditable||du(e)}function pu(e){if(du(e))return e.value;if(e.isContentEditable){let t=ru(e).createRange();return t.selectNodeContents(e),t.toString()}return``}function mu(e){let t=0,n=0;if(du(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){let r=ru(e).getSelection();if(r?.rangeCount&&r.anchorNode&&ou(e,r.anchorNode)&&r.focusNode&&ou(e,r.focusNode)){let i=r.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),n=a.toString().length}}return{start:t,end:n}}function hu(e,t){let n=[`dialog`,`menu`,`listbox`,`tree`,`grid`],r=e?.getAttribute(`role`);return r&&n.indexOf(r)!==-1?r:t}function gu(e){if(!e)return null;let t=e=>e===`auto`||e===`scroll`;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:n}=getComputedStyle(e);if(t(n))return e}return gu(e.parentElement)||document.scrollingElement||document.body}function _u(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function vu(e,t){let n=e.map((e,t)=>[t,e]),r=!1;return n.sort(([e,n],[i,a])=>{let o=t(n),s=t(a);return o===s||!o||!s?0:yu(o,s)?(e>i&&(r=!0),-1):(et):e}function yu(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function bu(){return tu&&!!navigator.maxTouchPoints}function xu(){return tu?/mac|iphone|ipad|ipod/i.test(navigator.platform):!1}function Su(){return tu&&xu()&&/apple/i.test(navigator.vendor)}function Cu(){return tu&&/firefox\//i.test(navigator.userAgent)}function wu(){return tu&&navigator.platform.startsWith(`Mac`)&&!bu()}function Tu(e){return!!(e.currentTarget&&!ou(e.currentTarget,e.target))}function Eu(e){return e.target===e.currentTarget}function Du(e){let t=e.currentTarget;if(!t)return!1;let n=xu();if(n&&!e.metaKey||!n&&!e.ctrlKey)return!1;let r=t.tagName.toLowerCase();return r===`a`||r===`button`&&t.type===`submit`||r===`input`&&t.type===`submit`}function Ou(e){let t=e.currentTarget;if(!t)return!1;let n=t.tagName.toLowerCase();return e.altKey?n===`a`||n===`button`&&t.type===`submit`||n===`input`&&t.type===`submit`:!1}function ku(e,t){let n=new FocusEvent(`blur`,t),r=e.dispatchEvent(n),i={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent(`focusout`,i)),r}function Au(e,t,n){let r=new KeyboardEvent(t,n);return e.dispatchEvent(r)}function ju(e,t){let n=new MouseEvent(`click`,t);return e.dispatchEvent(n)}function Mu(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!ou(n,r)}function Nu(e,t,n,r){let i=(e=>{if(r){let t=setTimeout(e,r);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),n()}),a=()=>{i(),n()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function Pu(e,t,n,r=window){let i=[];try{r.document.addEventListener(e,t,n);for(let a of Array.from(r.frames))i.push(Pu(e,t,n,a))}catch{}return()=>{try{r.document.removeEventListener(e,t,n)}catch{}for(let e of i)e()}}var Fu={...V},Iu=Fu.useId;Fu.useDeferredValue;var Lu=Fu.useInsertionEffect,Z=tu?V.useLayoutEffect:V.useEffect;function Ru(e){let[t]=(0,V.useState)(e);return t}function zu(e){let t=(0,V.useRef)(e);return Z(()=>{t.current=e}),t}function Q(e){let t=(0,V.useRef)(()=>{throw Error(`Cannot call an event handler while rendering.`)});return Lu?Lu(()=>{t.current=e}):t.current=e,(0,V.useCallback)((...e)=>t.current?.call(t,...e),[])}function Bu(e){let[t,n]=(0,V.useState)(null);return Z(()=>{if(t==null||!e)return;let n=null;return e(e=>(n=e,t)),()=>{e(n)}},[t,e]),[t,n]}function Vu(...e){return(0,V.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let n of e)Zl(n,t)}},e)}function Hu(e){if(Iu){let t=Iu();return e||t}let[t,n]=(0,V.useState)(e);return Z(()=>{e||t||n(`id-${Math.random().toString(36).slice(2,8)}`)},[e,t]),e||t}function Uu(e,t){let n=e=>{if(typeof e==`string`)return e},[r,i]=(0,V.useState)(()=>n(t));return Z(()=>{i((e&&`current`in e?e.current:e)?.tagName.toLowerCase()||n(t))},[e,t]),r}function Wu(e,t,n){let r=Ru(n),[i,a]=(0,V.useState)(r);return(0,V.useEffect)(()=>{let n=e&&`current`in e?e.current:e;if(!n)return;let i=()=>{a(n.getAttribute(t)??r)},o=new MutationObserver(i);return o.observe(n,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,r]),i}function Gu(e,t){let n=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if(n.current)return e();n.current=!0},t),(0,V.useEffect)(()=>()=>{n.current=!1},[])}function Ku(e,t){let n=(0,V.useRef)(!1);Z(()=>{if(n.current)return e();n.current=!0},t),Z(()=>()=>{n.current=!1},[])}function qu(){return(0,V.useReducer)(()=>[],[])}function Ju(e){return Q(typeof e==`function`?e:()=>e)}function Yu(e,t,n=[]){let r=(0,V.useCallback)(n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n)),[...n,e.wrapElement]);return{...e,wrapElement:r}}function Xu(e=!1,t){let[n,r]=(0,V.useState)(null);return{portalRef:Vu(r,t),portalNode:n,domReady:!e||n}}function Zu(e,t,n){let r=e.onLoadedMetadataCapture,i=(0,V.useMemo)(()=>Object.assign(()=>{},{...r,[t]:n}),[r,t,n]);return[r?.[t],{onLoadedMetadataCapture:i}]}var Qu=!1;function $u(){return(0,V.useEffect)(()=>{Qu||=(Pu(`mousemove`,id,!0),Pu(`mousedown`,ad,!0),Pu(`mouseup`,ad,!0),Pu(`keydown`,ad,!0),Pu(`scroll`,ad,!0),!0)},[]),Q(()=>ed)}var ed=!1,td=0,nd=0;function rd(e){let t=e.movementX||e.screenX-td,n=e.movementY||e.screenY-nd;return td=e.screenX,nd=e.screenY,t||n||!1}function id(e){rd(e)&&(ed=!0)}function ad(){ed=!1}function od(e){let t=V.forwardRef((t,n)=>e({...t,ref:n}));return t.displayName=e.displayName||e.name,t}function sd(e,t){return V.memo(e,t)}function cd(e,t){let{wrapElement:n,render:r,...i}=t,a=Vu(t.ref,$l(r)),o;if(V.isValidElement(r)){let e={...r.props,ref:a};o=V.cloneElement(r,eu(i,e))}else o=r?r(i):(0,U.jsx)(e,{...i});return n?n(o):o}function ld(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function ud(e=[],t=[]){let n=V.createContext(void 0),r=V.createContext(void 0),i=()=>V.useContext(n),a=(e=!1)=>{let t=V.useContext(r),n=i();return e?t:t||n},o=()=>{let e=V.useContext(r),t=i();if(!(e&&e===t))return t},s=t=>e.reduceRight((e,n)=>(0,U.jsx)(n,{...t,children:e}),(0,U.jsx)(n.Provider,{...t}));return{context:n,scopedContext:r,useContext:i,useScopedContext:a,useProviderContext:o,ContextProvider:s,ScopedContextProvider:e=>(0,U.jsx)(s,{...e,children:t.reduceRight((t,n)=>(0,U.jsx)(n,{...e,children:t}),(0,U.jsx)(r.Provider,{...e}))})}}var dd=ud(),fd=dd.useContext;dd.useScopedContext,dd.useProviderContext;var pd=dd.ContextProvider,md=dd.ScopedContextProvider,hd=ud([pd],[md]),gd=hd.useContext;hd.useScopedContext;var _d=hd.useProviderContext,vd=hd.ContextProvider,$=hd.ScopedContextProvider,yd=(0,V.createContext)(void 0),bd=(0,V.createContext)(void 0);function xd(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Sd(e,t){return t&&e.item(t)||null}function Cd(e){let t=[];for(let n of e){let e=t.find(e=>e[0]?.rowId===n.rowId);e?e.push(n):t.push([n])}return t}function wd(e,t=!1){if(du(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let n=ru(e).getSelection();n?.selectAllChildren(e),t&&n?.collapseToEnd()}}var Td=Symbol(`FOCUS_SILENTLY`);function Ed(e){e[Td]=!0,e.focus({preventScroll:!0})}function Dd(e){let t=e[Td];return delete e[Td],t}function Od(e,t,n){if(!t||t===n)return!1;let r=e.item(t.id);return!(!r||n&&r.element===n)}var kd=`div`,Ad=ld(function({store:e,shouldRegisterItem:t=!0,getItem:n=Gl,element:r,...i}){let a=fd();e||=a;let o=Hu(i.id),s=(0,V.useRef)(r);return(0,V.useEffect)(()=>{let r=s.current;if(!o||!r||!t)return;let i=n({id:o,element:r});return e?.renderItem(i)},[o,t,n,e]),i={...i,ref:Vu(s,i.ref)},Xl(i)});od(function(e){return cd(kd,Ad(e))});var jd=(0,V.createContext)(!0),Md=`input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])`;function Nd(e){return Number.parseInt(e.getAttribute(`tabindex`)||`0`,10)<0}function Pd(e){return!(!e.matches(Md)||!uu(e)||e.closest(`[inert]`))}function Fd(e){if(!Pd(e)||Nd(e))return!1;if(!(`form`in e)||!e.form||e.checked||e.type!==`radio`)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!(`length`in t))return!0;let n=au(e);return!n||n===e||!(`form`in n)||n.form!==e.form||n.name!==e.name}function Id(e,t){let n=Array.from(e.querySelectorAll(Md));t&&n.unshift(e);let r=n.filter(Pd);return r.forEach((e,t)=>{if(!su(e))return;let n=e.contentDocument?.body;n&&r.splice(t,1,...Id(n))}),r}function Ld(e,t,n){let r=Array.from(e.querySelectorAll(Md)),i=r.filter(Fd);return t&&Fd(e)&&i.unshift(e),i.forEach((e,t)=>{if(!su(e))return;let r=e.contentDocument?.body;if(!r)return;let a=Ld(r,!1,n);i.splice(t,1,...a)}),!i.length&&n?r:i}function Rd(e,t,n){let[r]=Ld(e,t,n);return r||null}function zd(e,t,n,r){let i=au(e),a=Id(e,t),o=a.indexOf(i),s=a.slice(o+1);return s.find(Fd)||(n?a.find(Fd):null)||(r?s[0]:null)||null}function Bd(e,t){return zd(document.body,!1,e,t)}function Vd(e,t,n,r){let i=au(e),a=Id(e,t).reverse(),o=a.indexOf(i),s=a.slice(o+1);return s.find(Fd)||(n?a.find(Fd):null)||(r?s[0]:null)||null}function Hd(e,t){return Vd(document.body,!1,e,t)}function Ud(e){for(;e&&!Pd(e);)e=e.closest(Md);return e||null}function Wd(e){let t=au(e);if(!t)return!1;if(t===e)return!0;let n=t.getAttribute(`aria-activedescendant`);return n?n===e.id:!1}function Gd(e){let t=au(e);if(!t)return!1;if(ou(e,t))return!0;let n=t.getAttribute(`aria-activedescendant`);return!n||!(`id`in e)?!1:n===e.id?!0:!!e.querySelector(`#${CSS.escape(n)}`)}function Kd(e){!Gd(e)&&Pd(e)&&e.focus()}function qd(e){let t=e.getAttribute(`tabindex`)??``;e.setAttribute(`data-tabindex`,t),e.setAttribute(`tabindex`,`-1`)}function Jd(e,t){let n=Ld(e,t);for(let e of n)qd(e)}function Yd(e){let t=e.querySelectorAll(`[data-tabindex]`),n=e=>{let t=e.getAttribute(`data-tabindex`);e.removeAttribute(`data-tabindex`),t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)};e.hasAttribute(`data-tabindex`)&&n(e);for(let e of t)n(e)}function Xd(e,t){`scrollIntoView`in e?(e.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`,inline:`nearest`,...t})):e.focus()}var Zd=`div`,Qd=Su(),$d=[`text`,`search`,`url`,`tel`,`email`,`password`,`number`,`date`,`month`,`week`,`time`,`datetime`,`datetime-local`],ef=Symbol(`safariFocusAncestor`);function tf(e){return e?!!e[ef]:!1}function nf(e,t){e&&(e[ef]=t)}function rf(e){let{tagName:t,readOnly:n,type:r}=e;return t===`TEXTAREA`&&!n||t===`SELECT`&&!n?!0:t===`INPUT`&&!n?$d.includes(r):!!(e.isContentEditable||e.getAttribute(`role`)===`combobox`&&e.dataset.name)}function af(e){return`labels`in e?e.labels:null}function of(e){return e.tagName.toLowerCase()===`input`&&e.type?e.type===`radio`||e.type===`checkbox`:!1}function sf(e){return e?e===`button`||e===`summary`||e===`input`||e===`select`||e===`textarea`||e===`a`:!0}function cf(e){return e?e===`button`||e===`input`||e===`select`||e===`textarea`:!0}function lf(e,t,n,r,i){return e?t?n&&!r?-1:void 0:n?i:i||0:i}function uf(e,t){return Q(n=>{e?.(n),!n.defaultPrevented&&t&&(n.stopPropagation(),n.preventDefault())})}var df=!1,ff=!0;function pf(e){let t=e.target;t&&`hasAttribute`in t&&(t.hasAttribute(`data-focus-visible`)||(ff=!1))}function mf(e){e.metaKey||e.ctrlKey||e.altKey||(ff=!0)}var hf=ld(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:n,onFocusVisible:r,...i}){let a=(0,V.useRef)(null);(0,V.useEffect)(()=>{e&&(df||=(Pu(`mousedown`,pf,!0),Pu(`keydown`,mf,!0),!0))},[e]),Qd&&(0,V.useEffect)(()=>{if(!e)return;let t=a.current;if(!t||!of(t))return;let n=af(t);if(!n)return;let r=()=>queueMicrotask(()=>t.focus());for(let e of n)e.addEventListener(`mouseup`,r);return()=>{for(let e of n)e.removeEventListener(`mouseup`,r)}},[e]);let o=e&&Yl(i),s=!!o&&!t,[c,l]=(0,V.useState)(!1);(0,V.useEffect)(()=>{e&&s&&c&&l(!1)},[e,s,c]),(0,V.useEffect)(()=>{if(!e||!c)return;let t=a.current;if(!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(()=>{Pd(t)||l(!1)});return n.observe(t),()=>n.disconnect()},[e,c]);let u=uf(i.onKeyPressCapture,o),d=uf(i.onMouseDownCapture,o),f=uf(i.onClickCapture,o),p=i.onMouseDown,m=Q(t=>{if(p?.(t),t.defaultPrevented||!e)return;let n=t.currentTarget;if(!Qd||Tu(t)||!cu(n)&&!of(n))return;let r=!1,i=()=>{r=!0};n.addEventListener(`focusin`,i,{capture:!0,once:!0});let a=Ud(n.parentElement);nf(a,!0),Nu(n,`mouseup`,()=>{n.removeEventListener(`focusin`,i,!0),nf(a,!1),!r&&Kd(n)})}),h=(t,n)=>{if(n&&(t.currentTarget=n),!e)return;let i=t.currentTarget;i&&Wd(i)&&(r?.(t),!t.defaultPrevented&&(i.dataset.focusVisible=`true`,l(!0)))},g=i.onKeyDownCapture,_=Q(t=>{if(g?.(t),t.defaultPrevented||!e||c||t.metaKey||t.altKey||t.ctrlKey||!Eu(t))return;let n=t.currentTarget;Nu(n,`focusout`,()=>h(t,n))}),v=i.onFocusCapture,y=Q(t=>{if(v?.(t),t.defaultPrevented||!e)return;if(!Eu(t)){l(!1);return}let n=t.currentTarget;ff||rf(t.target)?Nu(t.target,`focusout`,()=>h(t,n)):l(!1)}),b=i.onBlur,x=Q(t=>{b?.(t),e&&Mu(t)&&(t.currentTarget.removeAttribute(`data-focus-visible`),l(!1))}),S=(0,V.useContext)(jd),C=Q(t=>{e&&n&&t&&S&&queueMicrotask(()=>{Wd(t)||Pd(t)&&t.focus()})}),w=Uu(a),T=e&&sf(w),E=e&&cf(w),D=i.style,O=(0,V.useMemo)(()=>s?{pointerEvents:`none`,...D}:D,[s,D]);return i={"data-focus-visible":e&&c||void 0,"data-autofocus":n||void 0,"aria-disabled":o||void 0,...i,ref:Vu(a,C,i.ref),style:O,tabIndex:lf(e,s,T,E,i.tabIndex),disabled:E&&s?!0:void 0,contentEditable:o?void 0:i.contentEditable,onKeyPressCapture:u,onClickCapture:f,onMouseDownCapture:d,onMouseDown:m,onKeyDownCapture:_,onFocusCapture:y,onBlur:x},Xl(i)});od(function(e){return cd(Zd,hf(e))});var gf=`button`;function _f(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return e.key===`Enter`?cu(t)||t.tagName===`SUMMARY`||t.tagName===`A`:e.key===` `?cu(t)||t.tagName===`SUMMARY`||t.tagName===`INPUT`||t.tagName===`SELECT`:!1}var vf=Symbol(`command`),yf=ld(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...n}){let r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1);(0,V.useEffect)(()=>{r.current&&a(cu(r.current))},[]);let[o,s]=(0,V.useState)(!1),c=(0,V.useRef)(!1),l=Yl(n),[u,d]=Zu(n,vf,!0),f=n.onKeyDown,p=Q(n=>{f?.(n);let r=n.currentTarget;if(n.defaultPrevented||u||l||!Eu(n)||du(r)||r.isContentEditable)return;let i=e&&n.key===`Enter`,a=t&&n.key===` `,o=n.key===`Enter`&&!e,d=n.key===` `&&!t;if(o||d){n.preventDefault();return}if(i||a){let e=_f(n);if(i){if(!e){n.preventDefault();let{view:e,...t}=n,i=()=>ju(r,t);Cu()?Nu(r,`keyup`,i):queueMicrotask(i)}}else a&&(c.current=!0,e||(n.preventDefault(),s(!0)))}}),m=n.onKeyUp,h=Q(e=>{if(m?.(e),e.defaultPrevented||u||l||e.metaKey)return;let n=t&&e.key===` `;if(c.current&&n&&(c.current=!1,!_f(e))){e.preventDefault(),s(!1);let t=e.currentTarget,{view:n,...r}=e;queueMicrotask(()=>ju(t,r))}});return n={"data-active":o||void 0,type:i?`button`:void 0,...d,...n,ref:Vu(r,n.ref),onKeyDown:p,onKeyUp:h},n=hf(n),n});od(function(e){return cd(gf,yf(e))});function bf(e,t){let n=e.__unstableInternals;return Kl(n,`Invalid store`),n[t]}function xf(e,...t){let n=e,r=n,i=Symbol(),a=Rl,o=new Set,s=new Set,c=new Set,l=new Set,u=new Set,d=new WeakMap,f=new WeakMap,p=e=>(c.add(e),()=>c.delete(e)),m=()=>{let e=o.size,r=Symbol();o.add(r);let i=()=>{o.delete(r),!o.size&&a()};if(e)return i;let s=ql(n).map(e=>Vl(...t.map(t=>{let n=(t?.getState)?.call(t);if(n&&Bl(n,e))return Tf(t,[e],t=>{S(e,t[e],!0)})}))),l=[];for(let e of c)l.push(e());let u=t.map(Cf);return a=Vl(...s,...l,...u),i},h=(e,t,n=l)=>(n.add(t),f.set(t,e),()=>{var e;(e=d.get(t))==null||e(),d.delete(t),f.delete(t),n.delete(t)}),g=(e,t)=>h(e,t),_=(e,t)=>(d.set(t,t(n,n)),h(e,t)),v=(e,t)=>(d.set(t,t(n,r)),h(e,t,u)),y=e=>xf(Wl(n,e),C),b=e=>xf(Ul(n,e),C),x=()=>n,S=(e,a,o=!1)=>{var c;if(!Bl(n,e))return;let p=J(a,n[e]);if(p===n[e])return;if(!o)for(let n of t)(c=n?.setState)==null||c.call(n,e,p);let m=n;n={...n,[e]:p};let h=Symbol();i=h,s.add(e);let g=(t,r,i)=>{var a;let o=f.get(t);(!o||o.some(t=>i?i.has(t):t===e))&&((a=d.get(t))==null||a(),d.set(t,t(n,r)))};for(let e of l)g(e,m);queueMicrotask(()=>{if(i!==h)return;let e=n;for(let e of u)g(e,r,s);r=e,s.clear()})},C={getState:x,setState:S,__unstableInternals:{setup:p,init:m,subscribe:g,sync:_,batch:v,pick:y,omit:b}};return C}function Sf(e,...t){if(e)return bf(e,`setup`)(...t)}function Cf(e,...t){if(e)return bf(e,`init`)(...t)}function wf(e,...t){if(e)return bf(e,`subscribe`)(...t)}function Tf(e,...t){if(e)return bf(e,`sync`)(...t)}function Ef(e,...t){if(e)return bf(e,`batch`)(...t)}function Df(e,...t){if(e)return bf(e,`omit`)(...t)}function Of(e,...t){if(e)return bf(e,`pick`)(...t)}function kf(...e){let t={};for(let n of e){let e=(n?.getState)?.call(n);e&&Object.assign(t,e)}let n=xf(t,...e);return Object.assign({},...e,n)}var{useSyncExternalStore:Af}=e(A(),1).default,jf=()=>()=>{};function Mf(e,t=Gl){let n=V.useCallback(t=>e?wf(e,null,t):jf(),[e]),r=()=>{let n=typeof t==`string`?t:null,r=typeof t==`function`?t:null,i=e?.getState();if(r)return r(i);if(i&&n&&Bl(i,n))return i[n]};return Af(n,r,r)}function Nf(e,t){let n=V.useRef({}),r=V.useCallback(t=>e?wf(e,null,t):jf(),[e]),i=()=>{let r=e?.getState(),i=!1,a=n.current;for(let e in t){let n=t[e];if(typeof n==`function`){let t=n(r);t!==a[e]&&(a[e]=t,i=!0)}if(typeof n==`string`){if(!r||!Bl(r,n))continue;let t=r[n];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(n.current={...a}),n.current};return Af(r,i,i)}function Pf(e,t,n,r){let i=Bl(t,n)?t[n]:void 0,a=zu({value:i,setValue:r?t[r]:void 0});Z(()=>Tf(e,[n],(e,t)=>{let{value:r,setValue:i}=a.current;i&&e[n]!==t[n]&&e[n]!==r&&i(e[n])}),[e,n]),Z(()=>{if(i!==void 0)return e.setState(n,i),Ef(e,[n],()=>{i!==void 0&&e.setState(n,i)})})}function Ff(e,t){let[n,r]=V.useState(()=>e(t));Z(()=>Cf(n),[n]);let i=V.useCallback(e=>Mf(n,e),[n]);return[V.useMemo(()=>({...n,useState:i}),[n,i]),Q(()=>{r(n=>e({...t,...n.getState()}))})]}var If=`button`;function Lf(e){return fu(e)?!0:e.tagName===`INPUT`&&!cu(e)}function Rf(e,t=!1){let n=e.clientHeight,{top:r}=e.getBoundingClientRect(),i=Math.max(n*.875,n-40)*1.5,a=t?n-i+r:i+r;return e.tagName===`HTML`?a+e.scrollTop:a}function zf(e,t=!1){let{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Bf(e,t,n,r=!1){if(!t||!n)return;let{renderedItems:i}=t.getState(),a=gu(e);if(!a)return;let o=Rf(a,r),s,c;for(let e=0;e=0){c!==void 0&&ce.rowId===m);return f.ariaPosInSet+t.findIndex(e=>e.id===u)},isTabbable(t){if(!t?.renderedItems.length)return!0;if(t.virtualFocus)return!1;if(i)return!0;if(t.activeId===null)return!1;let n=e?.item(t.activeId);return n?.disabled||!n?.element?!0:t.activeId===u}}),b=(0,V.useCallback)(e=>{let t={...e,id:u||e.id,rowId:m,disabled:!!p,children:e.element?.textContent};return a?a(t):t},[u,m,p,a]),x=c.onFocus,S=(0,V.useRef)(!1),C=Q(t=>{if(x?.(t),t.defaultPrevented||Tu(t)||!u||!e||Vf(t,e))return;let{virtualFocus:n,baseElement:r}=e.getState();e.setActiveId(u),fu(t.currentTarget)&&wd(t.currentTarget),n&&Eu(t)&&(Lf(t.currentTarget)||r?.isConnected&&(Su()&&t.currentTarget.hasAttribute(`data-autofocus`)&&t.currentTarget.scrollIntoView({block:`nearest`,inline:`nearest`}),S.current=!0,t.relatedTarget===r||Od(e,t.relatedTarget)?Ed(r):r.focus()))}),w=c.onBlurCapture,T=Q(t=>{w?.(t),!t.defaultPrevented&&e?.getState()?.virtualFocus&&S.current&&(S.current=!1,t.preventDefault(),t.stopPropagation())}),E=c.onKeyDown,D=Ju(n),O=Ju(r),k=Q(t=>{if(E?.(t),t.defaultPrevented||!Eu(t)||!e)return;let{currentTarget:n}=t,r=e.getState(),i=!!e.item(u)?.rowId,a=r.orientation!==`horizontal`,o=r.orientation!==`vertical`,s=()=>!!(i||o||!r.baseElement||!du(r.baseElement)),c={ArrowUp:(i||a)&&e.up,ArrowRight:(i||o)&&e.next,ArrowDown:(i||a)&&e.down,ArrowLeft:(i||o)&&e.previous,Home:()=>{if(s())return!i||t.ctrlKey?e?.first():e?.previous(-1)},End:()=>{if(s())return!i||t.ctrlKey?e?.last():e?.next(-1)},PageUp:()=>Bf(n,e,e?.up,!0),PageDown:()=>Bf(n,e,e?.down)}[t.key];if(c){if(fu(n)){let e=mu(n),r=o&&t.key===`ArrowLeft`,i=o&&t.key===`ArrowRight`,s=a&&t.key===`ArrowUp`,c=a&&t.key===`ArrowDown`;if(i||c){let{length:t}=pu(n);if(e.end!==t)return}else if((r||s)&&e.start!==0)return}let r=c();if(D(t)||r!==void 0){if(!O(t))return;t.preventDefault(),e.move(r)}}}),A=(0,V.useMemo)(()=>({id:u,baseElement:h}),[u,h]);return c=Yu(c,e=>(0,U.jsx)(yd.Provider,{value:A,children:e}),[A]),c={id:u,"data-active-item":g||void 0,...c,ref:Vu(d,c.ref),tabIndex:y?c.tabIndex:-1,onFocus:C,onBlurCapture:T,onKeyDown:k},c=yf(c),c=Ad({store:e,...c,getItem:b,shouldRegisterItem:u?c.shouldRegisterItem:!1}),Xl({...c,"aria-setsize":_,"aria-posinset":v})});sd(od(function(e){return cd(If,Hf(e))}));function Uf(e){let t=[];for(let n of e)t.push(...n);return t}function Wf(e){return e.slice().reverse()}var Gf=`div`;function Kf(e){return e.some(e=>!!e.rowId)}function qf(e){let t=e.target;return t&&!du(t)?!1:e.key.length===1&&!e.ctrlKey&&!e.metaKey}function Jf(e){return e.key===`Shift`||e.key===`Control`||e.key===`Alt`||e.key===`Meta`}function Yf(e,t,n){return Q(r=>{if(t?.(r),r.defaultPrevented||r.isPropagationStopped()||!Eu(r)||Jf(r)||qf(r))return;let i=Sd(e,e.getState().activeId)?.element;if(!i)return;let{view:a,...o}=r;i!==n?.current&&i.focus(),Au(i,r.type,o)||r.preventDefault(),r.currentTarget.contains(i)&&r.stopPropagation()})}function Xf(e){return xd(Uf(Wf(Cd(e))))}function Zf(e){let[t,n]=(0,V.useState)(!1),r=(0,V.useCallback)(()=>n(!0),[]),i=e.useState(t=>Sd(e,t.activeId));return(0,V.useEffect)(()=>{let e=i?.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))},[i,t]),r}var Qf=ld(function({store:e,composite:t=!0,focusOnMove:n=t,moveOnKeyPress:r=!0,...i}){let a=_d();e||=a,Kl(e,!1);let o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=Zf(e),l=e.useState(`moves`),[,u]=Bu(t?e.setBaseElement:null);(0,V.useEffect)(()=>{if(!e||!l||!t||!n)return;let{activeId:r}=e.getState(),i=Sd(e,r)?.element;i&&Xd(i)},[e,l,t,n]),Z(()=>{if(!e||!l||!t)return;let{baseElement:n,activeId:r}=e.getState();if(r!==null||!n)return;let i=s.current;s.current=null,i&&ku(i,{relatedTarget:n}),Wd(n)||n.focus()},[e,l,t]);let d=e.useState(`activeId`),f=e.useState(`virtualFocus`);Z(()=>{if(!e||!t||!f)return;let n=s.current;if(s.current=null,!n)return;let r=Sd(e,d)?.element||au(n);r!==n&&ku(n,{relatedTarget:r})},[e,d,f,t]);let p=Yf(e,i.onKeyDownCapture,s),m=Yf(e,i.onKeyUpCapture,s),h=i.onFocusCapture,g=Q(t=>{if(h?.(t),t.defaultPrevented||!e)return;let{virtualFocus:n}=e.getState();if(!n)return;let r=t.relatedTarget,i=Dd(t.currentTarget);Eu(t)&&i&&(t.stopPropagation(),s.current=r)}),_=i.onFocus,v=Q(n=>{if(_?.(n),n.defaultPrevented||!t||!e)return;let{relatedTarget:r}=n,{virtualFocus:i}=e.getState();i?Eu(n)&&!Od(e,r)&&queueMicrotask(c):Eu(n)&&e.setActiveId(null)}),y=i.onBlurCapture,b=Q(t=>{if(y?.(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:r}=e.getState();if(!n)return;let i=Sd(e,r)?.element,a=t.relatedTarget,o=Od(e,a),c=s.current;s.current=null,Eu(t)&&o?(a===i?c&&c!==a&&ku(c,t):i?ku(i,t):c&&ku(c,t),t.stopPropagation()):!Od(e,t.target)&&i&&ku(i,t)}),x=i.onKeyDown,S=Ju(r),C=Q(t=>{if(x?.(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!Eu(t))return;let{orientation:n,renderedItems:r,activeId:i}=e.getState();if(Sd(e,i)?.element?.isConnected)return;let a=n!==`horizontal`,o=n!==`vertical`,s=Kf(r);if((t.key===`ArrowLeft`||t.key===`ArrowRight`||t.key===`Home`||t.key===`End`)&&du(t.currentTarget))return;let c={ArrowUp:(s||a)&&(()=>s?Xf(r)?.id:e?.last()),ArrowRight:(s||o)&&e.first,ArrowDown:(s||a)&&e.first,ArrowLeft:(s||o)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];if(c){let n=c();if(n!==void 0){if(!S(t))return;t.preventDefault(),e.move(n)}}});i=Yu(i,t=>(0,U.jsx)(vd,{value:e,children:t}),[e]);let w=e.useState(n=>{if(e&&t&&n.virtualFocus)return Sd(e,n.activeId)?.id});return i={"aria-activedescendant":w,...i,ref:Vu(o,u,i.ref),onKeyDownCapture:p,onKeyUpCapture:m,onFocusCapture:g,onFocus:v,onBlurCapture:b,onKeyDown:C},i=hf({focusable:e.useState(e=>t&&(e.virtualFocus||e.activeId===null)),...i}),i});od(function(e){return cd(Gf,Qf(e))});var $f=ud();$f.useContext,$f.useScopedContext;var ep=$f.useProviderContext,tp=$f.ContextProvider,np=$f.ScopedContextProvider,rp=ud([tp],[np]);rp.useContext,rp.useScopedContext;var ip=rp.useProviderContext,ap=rp.ContextProvider,op=rp.ScopedContextProvider,sp=(0,V.createContext)(void 0),cp=(0,V.createContext)(void 0),lp=`div`;function up(e,t){let n=setTimeout(t,e);return()=>clearTimeout(n)}function dp(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}function fp(...e){return e.join(`, `).split(`, `).reduce((e,t)=>{let n=t.endsWith(`ms`)?1:1e3,r=Number.parseFloat(t||`0s`)*n;return r>e?r:e},0)}function pp(e,t,n){return!n&&t!==!1&&(!e||!!t)}var mp=ld(function({store:e,alwaysVisible:t,...n}){let r=ep();e||=r,Kl(e,!1);let i=(0,V.useRef)(null),a=Hu(n.id),[o,s]=(0,V.useState)(null),c=e.useState(`open`),l=e.useState(`mounted`),u=e.useState(`animated`),d=e.useState(`contentElement`),f=Mf(e.disclosure,`contentElement`);Z(()=>{i.current&&e?.setContentElement(i.current)},[e]),Z(()=>{let t;return e?.setState(`animated`,e=>(t=e,!0)),()=>{t!==void 0&&e?.setState(`animated`,t)}},[e]),Z(()=>{if(u){if(!d?.isConnected){s(null);return}return dp(()=>{s(c?`enter`:l?`leave`:null)})}},[u,d,c,l]),Z(()=>{if(!e||!u||!o||!d)return;let t=()=>e?.setState(`animating`,!1),n=()=>(0,Tc.flushSync)(t);if(o===`leave`&&c||o===`enter`&&!c)return;if(typeof u==`number`)return up(u,n);let{transitionDuration:r,animationDuration:i,transitionDelay:a,animationDelay:s}=getComputedStyle(d),{transitionDuration:l=`0`,animationDuration:p=`0`,transitionDelay:m=`0`,animationDelay:h=`0`}=f?getComputedStyle(f):{},g=fp(a,s,m,h)+fp(r,i,l,p);if(!g){o===`enter`&&e.setState(`animated`,!1),t();return}return up(Math.max(g-1e3/60,0),n)},[e,u,d,f,c,o]),n=Yu(n,t=>(0,U.jsx)(op,{value:e,children:t}),[e]);let p=pp(l,n.hidden,t),m=n.style,h=(0,V.useMemo)(()=>p?{...m,display:`none`}:m,[p,m]);return n={id:a,"data-open":c||void 0,"data-enter":o===`enter`||void 0,"data-leave":o===`leave`||void 0,hidden:p,...n,ref:Vu(a?e.setContentElement:null,i,n.ref),style:h},Xl(n)}),hp=od(function(e){return cd(lp,mp(e))});od(function({unmountOnHide:e,...t}){let n=ep();return Mf(t.store||n,t=>!e||t?.mounted)===!1?null:(0,U.jsx)(hp,{...t})});function gp(e={}){let t=kf(e.store,Df(e.disclosure,[`contentElement`,`disclosureElement`])),n=t?.getState(),r=X(e.open,n?.open,e.defaultOpen,!1),i=X(e.animated,n?.animated,!1),a=xf({open:r,animated:i,animating:!!i&&r,mounted:r,contentElement:X(n?.contentElement,null),disclosureElement:X(n?.disclosureElement,null)},t);return Sf(a,()=>Tf(a,[`animated`,`animating`],e=>{e.animated||a.setState(`animating`,!1)})),Sf(a,()=>wf(a,[`open`],()=>{a.getState().animated&&a.setState(`animating`,!0)})),Sf(a,()=>Tf(a,[`open`,`animating`],e=>{a.setState(`mounted`,e.open||e.animating)})),{...a,disclosure:e.disclosure,setOpen:e=>a.setState(`open`,e),show:()=>a.setState(`open`,!0),hide:()=>a.setState(`open`,!1),toggle:()=>a.setState(`open`,e=>!e),stopAnimation:()=>a.setState(`animating`,!1),setContentElement:e=>a.setState(`contentElement`,e),setDisclosureElement:e=>a.setState(`disclosureElement`,e)}}function _p(e,t,n){return Gu(t,[n.store,n.disclosure]),Pf(e,n,`open`,`setOpen`),Pf(e,n,`mounted`,`setMounted`),Pf(e,n,`animated`),Object.assign(e,{disclosure:n.disclosure})}function vp(e={}){let[t,n]=Ff(gp,e);return _p(t,n,e)}var yp=ud([ap],[op]);yp.useContext,yp.useScopedContext;var bp=yp.useProviderContext,xp=yp.ContextProvider,Sp=yp.ScopedContextProvider;function Cp(e){let t=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),r=t?.element?.parentElement;for(;r&&n?.element;){if(n&&r.contains(n.element))return r;r=r.parentElement}return ru(r).body}function wp(e){return e?.__unstablePrivateStore}function Tp(e={}){e.store;let t=e.store?.getState(),n=X(e.items,t?.items,e.defaultItems,[]),r=new Map(n.map(e=>[e.id,e])),i={items:n,renderedItems:X(t?.renderedItems,[])},a=wp(e.store),o=xf({items:n,renderedItems:i.renderedItems},a),s=xf(i,e.store),c=e=>{let t=vu(e,e=>e.element);o.setState(`renderedItems`,t),s.setState(`renderedItems`,t)};Sf(s,()=>Cf(o)),Sf(o,()=>Ef(o,[`items`],e=>{s.setState(`items`,e.items)})),Sf(o,()=>Ef(o,[`renderedItems`],e=>{let t=!0,n=requestAnimationFrame(()=>{let{renderedItems:t}=s.getState();e.renderedItems!==t&&c(e.renderedItems)});if(typeof IntersectionObserver!=`function`)return()=>cancelAnimationFrame(n);let r=()=>{if(t){t=!1;return}cancelAnimationFrame(n),n=requestAnimationFrame(()=>c(e.renderedItems))},i=Cp(e.renderedItems),a=new IntersectionObserver(r,{root:i});for(let t of e.renderedItems)t.element&&a.observe(t.element);return()=>{cancelAnimationFrame(n),a.disconnect()}}));let l=(e,t,n=!1)=>{let i;return t(t=>{let n=t.findIndex(({id:t})=>t===e.id),a=t.slice();if(n!==-1){i=t[n];let o={...i,...e};a[n]=o,r.set(e.id,o)}else a.push(e),r.set(e.id,e);return a}),()=>{t(t=>{if(!i)return n&&r.delete(e.id),t.filter(({id:t})=>t!==e.id);let a=t.findIndex(({id:t})=>t===e.id);if(a===-1)return t;let o=t.slice();return o[a]=i,r.set(e.id,i),o})}},u=e=>l(e,e=>o.setState(`items`,e),!0);return{...s,registerItem:u,renderItem:e=>Vl(u(e),l(e,e=>o.setState(`renderedItems`,e))),item:e=>{if(!e)return null;let t=r.get(e);if(!t){let{items:n}=o.getState();t=n.find(t=>t.id===e),t&&r.set(e,t)}return t||null},__unstablePrivateStore:o}}function Ep(e,t,n){return Gu(t,[n.store]),Pf(e,n,`items`,`setItems`),e}var Dp={id:null};function Op(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function kp(e,t){return e.filter(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Ap(e,t){return e.filter(e=>e.rowId===t)}function jp(e,t,n=!1){let r=e.findIndex(e=>e.id===t);return[...e.slice(r+1),...n?[Dp]:[],...e.slice(0,r)]}function Mp(e){let t=[];for(let n of e){let e=t.find(e=>e[0]?.rowId===n.rowId);e?e.push(n):t.push([n])}return t}function Np(e){let t=0;for(let{length:n}of e)n>t&&(t=n);return t}function Pp(e){return{id:`__EMPTY_ITEM__`,disabled:!0,rowId:e}}function Fp(e,t,n){let r=Np(e);for(let i of e)for(let e=0;eTf(i,[`renderedItems`,`activeId`],e=>{i.setState(`activeId`,t=>t===void 0?Op(e.renderedItems)?.id:t)}));let a=(e=`next`,t={})=>{let n=i.getState(),{skip:r=0,activeId:a=n.activeId,focusShift:o=n.focusShift,focusLoop:s=n.focusLoop,focusWrap:c=n.focusWrap,includesBaseElement:l=n.includesBaseElement,renderedItems:u=n.renderedItems,rtl:d=n.rtl}=t,f=e===`up`||e===`down`,p=e===`next`||e===`down`,m=p?d&&!f:!d||f,h=o&&!r,g=f?Uf(Fp(Mp(u),a,h)):u;if(g=m?Wf(g):g,g=f?Ip(g):g,a==null)return Op(g)?.id;let _=g.find(e=>e.id===a);if(!_)return Op(g)?.id;let v=g.some(e=>e.rowId),y=g.indexOf(_),b=g.slice(y+1),x=Ap(b,_.rowId);if(r){let e=kp(x,a);return(e.slice(r)[0]||e[e.length-1])?.id}let S=s&&(f?s!==`horizontal`:s!==`vertical`),C=v&&c&&(f?c!==`horizontal`:c!==`vertical`),w=p?(!v||f)&&S&&l:f?l:!1;if(S)return Op(jp(C&&!w?g:Ap(g,_.rowId),a,w),a)?.id;if(C){let e=Op(w?x:b,a);return w?e?.id||null:e?.id}let T=Op(x,a);return!T&&w?null:T?.id};return{...n,...i,setBaseElement:e=>i.setState(`baseElement`,e),setActiveId:e=>i.setState(`activeId`,e),move:e=>{e!==void 0&&(i.setState(`activeId`,e),i.setState(`moves`,e=>e+1))},first:()=>Op(i.getState().renderedItems)?.id,last:()=>Op(Wf(i.getState().renderedItems))?.id,next:e=>(e!==void 0&&typeof e==`number`&&(e={skip:e}),a(`next`,e)),previous:e=>(e!==void 0&&typeof e==`number`&&(e={skip:e}),a(`previous`,e)),down:e=>(e!==void 0&&typeof e==`number`&&(e={skip:e}),a(`down`,e)),up:e=>(e!==void 0&&typeof e==`number`&&(e={skip:e}),a(`up`,e))}}function Rp(e){return{id:Hu(e.id),...e}}function zp(e,t,n){return e=Ep(e,t,n),Pf(e,n,`activeId`,`setActiveId`),Pf(e,n,`includesBaseElement`),Pf(e,n,`virtualFocus`),Pf(e,n,`orientation`),Pf(e,n,`rtl`),Pf(e,n,`focusLoop`),Pf(e,n,`focusWrap`),Pf(e,n,`focusShift`),e}var Bp=(0,V.createContext)(void 0),Vp=ud([xp,vd],[Sp,$]),Hp=Vp.useContext,Up=Vp.useScopedContext,Wp=Vp.useProviderContext,Gp=Vp.ContextProvider,Kp=Vp.ScopedContextProvider,qp=(0,V.createContext)(void 0),Jp=(0,V.createContext)(!1),Yp=(0,V.createContext)(null),Xp=`span`,Zp=ld(function(e){return e={...e,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,whiteSpace:`nowrap`,width:`1px`,...e.style}},e});od(function(e){return cd(Xp,Zp(e))});var Qp=`span`,$p=ld(function(e){return e={"data-focus-trap":``,tabIndex:0,"aria-hidden":!0,...e,style:{position:`fixed`,top:0,left:0,...e.style}},e=Zp(e),e}),em=od(function(e){return cd(Qp,$p(e))}),tm=`div`;function nm(e){return ru(e).body}function rm(e,t){return t?typeof t==`function`?t(e):t:ru(e).createElement(`div`)}function im(e=`id`){return`${e?`${e}-`:``}${Math.random().toString(36).slice(2,8)}`}function am(e){queueMicrotask(()=>{e?.focus()})}var om=ld(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:n,portalRef:r,portal:i=!0,...a}){let o=(0,V.useRef)(null),s=Vu(o,a.ref),c=(0,V.useContext)(Yp),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=(0,V.useRef)(null),g=(0,V.useRef)(null);return Z(()=>{let e=o.current;if(!e||!i){u(null);return}let t=rm(e,n);if(!t){u(null);return}let a=t.isConnected;if(a||(c||nm(e)).appendChild(t),t.id||=e.id?`portal/${e.id}`:im(),u(t),Zl(r,t),!a)return()=>{t.remove(),Zl(r,null)}},[i,n,c,r]),Z(()=>{if(!i||!e||!t)return;let n=ru(t).createElement(`span`);return n.style.position=`fixed`,t.insertAdjacentElement(`afterend`,n),f(n),()=>{n.remove(),f(null)}},[i,e,t]),(0,V.useEffect)(()=>{if(!l||!e)return;let t=0,n=e=>{if(!Mu(e))return;let n=e.type===`focusin`;if(cancelAnimationFrame(t),n)return Yd(l);t=requestAnimationFrame(()=>{Jd(l,!0)})};return l.addEventListener(`focusin`,n,!0),l.addEventListener(`focusout`,n,!0),()=>{cancelAnimationFrame(t),l.removeEventListener(`focusin`,n,!0),l.removeEventListener(`focusout`,n,!0)}},[l,e]),a=Yu(a,t=>{if(t=(0,U.jsx)(Yp.Provider,{value:l||c,children:t}),!i)return t;if(!l)return(0,U.jsx)(`span`,{ref:s,id:a.id,style:{position:`fixed`},hidden:!0});t=(0,U.jsxs)(U.Fragment,{children:[e&&l&&(0,U.jsx)(em,{ref:m,"data-focus-trap":a.id,className:`__focus-trap-inner-before`,onFocus:e=>{Mu(e,l)?am(Bd()):am(p.current)}}),t,e&&l&&(0,U.jsx)(em,{ref:h,"data-focus-trap":a.id,className:`__focus-trap-inner-after`,onFocus:e=>{Mu(e,l)?am(Hd()):am(g.current)}})]}),l&&(t=(0,Tc.createPortal)(t,l));let n=(0,U.jsxs)(U.Fragment,{children:[e&&l&&(0,U.jsx)(em,{ref:p,"data-focus-trap":a.id,className:`__focus-trap-outer-before`,onFocus:e=>{e.relatedTarget!==g.current&&Mu(e,l)?am(m.current):am(Hd())}}),e&&(0,U.jsx)(`span`,{"aria-owns":l?.id,style:{position:`fixed`}}),e&&l&&(0,U.jsx)(em,{ref:g,"data-focus-trap":a.id,className:`__focus-trap-outer-after`,onFocus:e=>{if(Mu(e,l))am(h.current);else{let e=Bd();if(e===m.current){requestAnimationFrame(()=>Bd()?.focus());return}am(e)}}})]});return d&&e&&(n=(0,Tc.createPortal)(n,d)),(0,U.jsxs)(U.Fragment,{children:[n,t]})},[l,c,i,a.id,e,d]),a={...a,ref:s},a});od(function(e){return cd(tm,om(e))});var sm=(0,V.createContext)(0);function cm({level:e,children:t}){let n=(0,V.useContext)(sm),r=Math.max(Math.min(e||n+1,6),1);return(0,U.jsx)(sm.Provider,{value:r,children:t})}var lm=`div`,um=ld(function({autoFocusOnShow:e=!0,...t}){return t=Yu(t,t=>(0,U.jsx)(jd.Provider,{value:e,children:t}),[e]),t});od(function(e){return cd(lm,um(e))});function dm(e,t){let n=ru(e).createElement(`button`);return n.type=`button`,n.tabIndex=-1,n.textContent=`Dismiss popup`,Object.assign(n.style,{border:`0px`,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:`0px`,position:`absolute`,whiteSpace:`nowrap`,width:`1px`}),n.addEventListener(`click`,t),e.prepend(n),()=>{n.removeEventListener(`click`,t),n.remove()}}function fm(e){let t=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!e){t.current=null;return}return Pu(`mousedown`,e=>{t.current=e.target},!0)},[e]),t}var pm=new WeakMap;function mm(e,t,n){pm.has(e)||pm.set(e,new Map);let r=pm.get(e),i=r.get(t);if(!i)return r.set(t,n()),()=>{var e;(e=r.get(t))==null||e(),r.delete(t)};let a=n(),o=()=>{a(),i(),r.delete(t)};return r.set(t,o),()=>{r.get(t)===o&&(a(),r.set(t,i))}}function hm(e,t,n){return mm(e,t,()=>{let r=e.getAttribute(t);return e.setAttribute(t,n),()=>{r==null?e.removeAttribute(t):e.setAttribute(t,r)}})}function gm(e,t,n){return mm(e,t,()=>{let r=t in e,i=e[t];return e[t]=n,()=>{r?e[t]=i:delete e[t]}})}function _m(e,t){return e?mm(e,`style`,()=>{let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}):()=>{}}function vm(e,t,n){return e?mm(e,t,()=>{let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{r?e.style.setProperty(t,r):e.style.removeProperty(t)}}):()=>{}}var ym=[`SCRIPT`,`STYLE`];function bm(e){return`__ariakit-dialog-snapshot-${e}`}function xm(e,t){let n=ru(t),r=bm(e);if(!n.body[r])return!0;do{if(t===n.body)return!1;if(t[r])return!0;if(!t.parentElement)return!1;t=t.parentElement}while(!0)}function Sm(e,t,n){return ym.includes(t.tagName)||!xm(e,t)?!1:!n.some(e=>e&&ou(t,e))}function Cm(e,t,n,r){for(let i of t){if(!i?.isConnected)continue;let a=t.some(e=>!e||e===i?!1:e.contains(i)),o=ru(i),s=i;for(;i.parentElement&&i!==o.body;){if(r?.(i.parentElement,s),!a)for(let r of i.parentElement.children)Sm(e,r,t)&&n(r,s);i=i.parentElement}}}function wm(e,t){let{body:n}=ru(t[0]),r=[];return Cm(e,t,t=>{r.push(gm(t,bm(e),!0))}),Vl(gm(n,bm(e),!0),()=>{for(let e of r)e()})}function Tm(e,...t){if(!e)return!1;let n=e.getAttribute(`data-backdrop`);return n==null?!1:n===``||n===`true`||!t.length?!0:t.some(e=>n===e)}function Em(e=``,t=!1){return`__ariakit-dialog-${t?`ancestor`:`outside`}${e?`-${e}`:``}`}function Dm(e,t=``){return Vl(gm(e,Em(),!0),gm(e,Em(t),!0))}function Om(e,t=``){return Vl(gm(e,Em(``,!0),!0),gm(e,Em(t,!0),!0))}function km(e,t){let n=Em(t,!0);if(e[n])return!0;let r=Em(t);do{if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}while(!0)}function Am(e,t){let n=[],r=t.map(e=>e?.id);return Cm(e,t,t=>{Tm(t,...r)||n.unshift(Dm(t,e))},(t,r)=>{r.hasAttribute(`data-dialog`)&&r.id!==e||n.unshift(Om(t,e))}),()=>{for(let e of n)e()}}function jm(e){return e.tagName===`HTML`?!0:ou(ru(e).body,e)}function Mm(e,t){if(!e)return!1;if(ou(e,t))return!0;let n=t.getAttribute(`aria-activedescendant`);if(n){let t=ru(e).getElementById(n);if(t)return ou(e,t)}return!1}function Nm(e,t){if(!(`clientY`in e))return!1;let n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=e.clientY&&e.clientY<=n.top+n.height&&n.left<=e.clientX&&e.clientX<=n.left+n.width}function Pm({store:e,type:t,listener:n,capture:r,domReady:i}){let a=Q(n),o=Mf(e,`open`),s=(0,V.useRef)(!1);Z(()=>{if(!o||!i)return;let{contentElement:t}=e.getState();if(!t)return;let n=()=>{s.current=!0};return t.addEventListener(`focusin`,n,!0),()=>t.removeEventListener(`focusin`,n,!0)},[e,o,i]),(0,V.useEffect)(()=>o?Pu(t,t=>{let{contentElement:n,disclosureElement:r}=e.getState(),i=t.target;n&&i&&jm(i)&&(ou(n,i)||Mm(r,i)||i.hasAttribute(`data-focus-trap`)||Nm(t,n)||s.current&&!km(i,n.id)||tf(i)||a(t))},r):void 0,[o,r])}function Fm(e,t){return typeof e==`function`?e(t):!!e}function Im(e,t,n){let r=fm(Mf(e,`open`)),i={store:e,domReady:n,capture:!0};Pm({...i,type:`click`,listener:n=>{let{contentElement:i}=e.getState(),a=r.current;a&&uu(a)&&km(a,i?.id)&&Fm(t,n)&&e.hide()}}),Pm({...i,type:`focusin`,listener:n=>{let{contentElement:r}=e.getState();r&&n.target!==ru(r)&&Fm(t,n)&&e.hide()}}),Pm({...i,type:`contextmenu`,listener:n=>{Fm(t,n)&&e.hide()}})}var Lm=(0,V.createContext)({});function Rm(e){let t=(0,V.useContext)(Lm),[n,r]=(0,V.useState)([]),i=(0,V.useCallback)(e=>(r(t=>[...t,e]),Vl(t.add?.call(t,e),()=>{r(t=>t.filter(t=>t!==e))})),[t]);Z(()=>Tf(e,[`open`,`contentElement`],n=>{if(n.open&&n.contentElement)return t.add?.call(t,e)}),[e,t]);let a=(0,V.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,V.useCallback)(e=>(0,U.jsx)(Lm.Provider,{value:a,children:e}),[a]),nestedDialogs:n}}function zm({attribute:e,contentId:t,contentElement:n,enabled:r}){let[i,a]=qu(),o=(0,V.useCallback)(()=>{if(!r||!n)return!1;let{body:i}=ru(n),a=i.getAttribute(e);return!a||a===t},[i,r,n,e,t]);return(0,V.useEffect)(()=>{if(!r||!t||!n)return;let{body:i}=ru(n);if(o())return i.setAttribute(e,t),()=>i.removeAttribute(e);let s=new MutationObserver(()=>(0,Tc.flushSync)(a));return s.observe(i,{attributeFilter:[e]}),()=>s.disconnect()},[i,r,t,n,o,e]),o}function Bm(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?`paddingLeft`:`paddingRight`}function Vm(e,t,n){let r=zm({attribute:`data-dialog-prevent-body-scroll`,contentElement:e,contentId:t,enabled:n});(0,V.useEffect)(()=>{if(!r()||!e)return;let t=ru(e),n=iu(e),{documentElement:i,body:a}=t,o=i.style.getPropertyValue(`--scrollbar-width`),s=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,c=()=>vm(i,`--scrollbar-width`,`${s}px`),l=Bm(i),u=()=>_m(a,{overflow:`hidden`,[l]:`${s}px`}),d=()=>{let{scrollX:e,scrollY:t,visualViewport:r}=n,i=r?.offsetLeft??0,o=r?.offsetTop??0,c=_m(a,{position:`fixed`,overflow:`hidden`,top:`${-(t-Math.floor(o))}px`,left:`${-(e-Math.floor(i))}px`,right:`0`,[l]:`${s}px`});return()=>{c(),n.scrollTo({left:e,top:t,behavior:`instant`})}},f=xu()&&!wu();return Vl(c(),f?d():u())},[r,e])}function Hm(e,...t){if(!e)return!1;let n=e.getAttribute(`data-focus-trap`);return n==null?!1:t.length?n===``?!1:t.some(e=>n===e):!0}function Um(){return`inert`in HTMLElement.prototype}function Wm(e){return hm(e,`aria-hidden`,`true`)}function Gm(e,t){return`style`in e?Um()?gm(e,`inert`,!0):Vl(...Ld(e,!0).map(e=>{if(t?.some(t=>t&&ou(t,e)))return Rl;let n=mm(e,`focus`,()=>(e.focus=Rl,()=>{delete e.focus}));return Vl(hm(e,`tabindex`,`-1`),n)}),Wm(e),_m(e,{pointerEvents:`none`,userSelect:`none`,cursor:`default`})):Rl}function Km(e,t){let n=[],r=t.map(e=>e?.id);return Cm(e,t,e=>{Tm(e,...r)||Hm(e,...r)||n.unshift(Gm(e,t))},e=>{e.hasAttribute(`role`)&&(t.some(t=>t&&ou(t,e))||n.unshift(hm(e,`role`,`none`)))}),()=>{for(let e of n)e()}}var qm=`div`,Jm=`a.button.details.dialog.div.form.h1.h2.h3.h4.h5.h6.header.img.input.label.li.nav.ol.p.section.select.span.summary.textarea.ul.svg`.split(`.`);ld(function(e){return e});var Ym=od(function(e){return cd(qm,e)});Object.assign(Ym,Jm.reduce((e,t)=>(e[t]=od(function(e){return cd(t,e)}),e),{}));function Xm({store:e,backdrop:t,alwaysVisible:n,hidden:r}){let i=(0,V.useRef)(null),a=vp({disclosure:e}),o=Mf(e,`contentElement`);(0,V.useEffect)(()=>{let e=i.current,t=o;e&&t&&(e.style.zIndex=getComputedStyle(t).zIndex)},[o]),Z(()=>{let e=o?.id;if(!e)return;let t=i.current;if(t)return Om(t,e)},[o]);let s=mp({ref:i,store:a,role:`presentation`,"data-backdrop":o?.id||``,alwaysVisible:n,hidden:r??void 0,style:{position:`fixed`,top:0,right:0,bottom:0,left:0}});if(!t)return null;if((0,V.isValidElement)(t))return(0,U.jsx)(Ym,{...s,render:t});let c=typeof t==`boolean`?`div`:t;return(0,U.jsx)(Ym,{...s,render:(0,U.jsx)(c,{})})}function Zm(e={}){return gp(e)}function Qm(e,t,n){return _p(e,t,n)}function $m(e={}){let[t,n]=Ff(Zm,e);return Qm(t,n,e)}var eh=`div`,th=Su();function nh(e){let t=au();return!t||e&&ou(e,t)?!1:!!Pd(t)}function rh(e,t=!1){if(!e)return null;let n=`current`in e?e.current:e;return n?t?Pd(n)?n:null:n:null}var ih=ld(function({store:e,open:t,onClose:n,focusable:r=!0,modal:i=!0,portal:a=!!i,backdrop:o=!!i,hideOnEscape:s=!0,hideOnInteractOutside:c=!0,getPersistentElements:l,preventBodyScroll:u=!!i,autoFocusOnShow:d=!0,autoFocusOnHide:f=!0,initialFocus:p,finalFocus:m,unmountOnHide:h,unstable_treeSnapshotKey:g,..._}){let v=ip(),y=(0,V.useRef)(null),b=$m({store:e||v,open:t,setOpen(e){if(e)return;let t=y.current;if(!t)return;let r=new Event(`close`,{bubbles:!1,cancelable:!0});n&&t.addEventListener(`close`,n,{once:!0}),t.dispatchEvent(r),r.defaultPrevented&&b.setOpen(!0)}}),{portalRef:x,domReady:S}=Xu(a,_.portalRef),C=_.preserveTabOrder,w=Mf(b,e=>C&&!i&&e.mounted),T=Hu(_.id),E=Mf(b,`open`),D=Mf(b,`mounted`),O=Mf(b,`contentElement`),k=pp(D,_.hidden,_.alwaysVisible);Vm(O,T,u&&!k),Im(b,c,S);let{wrapElement:A,nestedDialogs:j}=Rm(b);_=Yu(_,A,[A]),Z(()=>{if(!E)return;let e=y.current,t=au(e,!0);t&&t.tagName!==`BODY`&&(e&&ou(e,t)||b.setDisclosureElement(t))},[b,E]),th&&(0,V.useEffect)(()=>{if(!D)return;let{disclosureElement:e}=b.getState();if(!e||!cu(e))return;let t=()=>{let t=!1,n=()=>{t=!0};e.addEventListener(`focusin`,n,{capture:!0,once:!0}),Nu(e,`mouseup`,()=>{e.removeEventListener(`focusin`,n,!0),!t&&Kd(e)})};return e.addEventListener(`mousedown`,t),()=>{e.removeEventListener(`mousedown`,t)}},[b,D]),(0,V.useEffect)(()=>{if(!D||!S)return;let e=y.current;if(!e)return;let t=iu(e),n=t.visualViewport||t,r=()=>{let n=t.visualViewport?.height??t.innerHeight;e.style.setProperty(`--dialog-viewport-height`,`${n}px`)};return r(),n.addEventListener(`resize`,r),()=>{n.removeEventListener(`resize`,r)}},[D,S]),(0,V.useEffect)(()=>{if(!i||!D||!S)return;let e=y.current;if(e&&!e.querySelector(`[data-dialog-dismiss]`))return dm(e,b.hide)},[b,i,D,S]),Z(()=>{if(!Um()||E||!D||!S)return;let e=y.current;if(e)return Gm(e)},[E,D,S]);let M=E&&S;Z(()=>{if(!T||!M)return;let e=y.current;return wm(T,[e])},[T,M,g]);let ee=Q(l);Z(()=>{if(!T||!M)return;let{disclosureElement:e}=b.getState(),t=[y.current,...ee()||[],...j.map(e=>e.getState().contentElement)];return i?Vl(Am(T,t),Km(T,t)):Am(T,[e,...t])},[T,b,M,ee,j,i,g]);let N=!!d,P=Ju(d),[F,te]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!E||!N||!S||!O?.isConnected)return;let e=rh(p,!0)||O.querySelector(`[data-autofocus=true],[autofocus]`)||Rd(O,!0,a&&w)||O,t=Pd(e);P(t?e:null)&&(te(!0),queueMicrotask(()=>{e.focus(),th&&t&&e.scrollIntoView({block:`nearest`,inline:`nearest`})}))},[E,N,S,O,p,a,w,P]);let I=!!f,ne=Ju(f),[L,R]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(E)return R(!0),()=>R(!1)},[E]);let re=(0,V.useCallback)((e,t=!0)=>{let{disclosureElement:n}=b.getState();if(nh(e))return;let r=rh(m)||n;if(r?.id){let e=ru(r),t=`[aria-activedescendant="${r.id}"]`,n=e.querySelector(t);n&&(r=n)}if(r&&!Pd(r)){let e=r.closest(`[data-dialog]`);if(e?.id){let t=ru(e),n=`[aria-controls~="${e.id}"]`,i=t.querySelector(n);i&&(r=i)}}let i=r&&Pd(r);if(!i&&t){requestAnimationFrame(()=>re(e,!1));return}ne(i?r:null)&&i&&r?.focus({preventScroll:!0})},[b,m,ne]),z=(0,V.useRef)(!1);Z(()=>{if(E||!L||!I)return;let e=y.current;z.current=!0,re(e)},[E,L,S,I,re]),(0,V.useEffect)(()=>{if(!L||!I)return;let e=y.current;return()=>{if(z.current){z.current=!1;return}re(e)}},[L,I,re]);let B=Ju(s);(0,V.useEffect)(()=>!S||!D?void 0:Pu(`keydown`,e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=y.current;if(!t||km(t))return;let n=e.target;if(!n)return;let{disclosureElement:r}=b.getState();(n.tagName===`BODY`||ou(t,n)||!r||ou(r,n))&&B(e)&&b.hide()},!0),[b,S,D,B]),_=Yu(_,e=>(0,U.jsx)(cm,{level:i?1:void 0,children:e}),[i]);let ie=_.hidden,H=_.alwaysVisible;_=Yu(_,e=>o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Xm,{store:b,backdrop:o,hidden:ie,alwaysVisible:H}),e]}):e,[b,o,ie,H]);let[ae,oe]=(0,V.useState)(),[se,ce]=(0,V.useState)();return _=Yu(_,e=>(0,U.jsx)(op,{value:b,children:(0,U.jsx)(sp.Provider,{value:oe,children:(0,U.jsx)(cp.Provider,{value:ce,children:e})})}),[b]),_={id:T,"data-dialog":``,role:`dialog`,tabIndex:r?-1:void 0,"aria-labelledby":ae,"aria-describedby":se,..._,ref:Vu(y,_.ref)},_=um({..._,autoFocusOnShow:F}),_=mp({store:b,..._}),_=hf({..._,focusable:r}),_=om({portal:a,..._,portalRef:x,preserveTabOrder:w}),_});function ah(e,t=ip){return od(function(n){let r=t();return Mf(n.store||r,e=>!n.unmountOnHide||e?.mounted||!!n.open)?(0,U.jsx)(e,{...n}):null})}ah(od(function(e){return cd(eh,ih(e))}),ip);var oh=Math.min,sh=Math.max,ch=Math.round,lh=Math.floor,uh=e=>({x:e,y:e}),dh={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function fh(e,t,n){return sh(e,oh(t,n))}function ph(e,t){return typeof e==`function`?e(t):e}function mh(e){return e.split(`-`)[0]}function hh(e){return e.split(`-`)[1]}function gh(e){return e===`x`?`y`:`x`}function _h(e){return e===`y`?`height`:`width`}function vh(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function yh(e){return gh(vh(e))}function bh(e,t,n){n===void 0&&(n=!1);let r=hh(e),i=yh(e),a=_h(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=kh(o)),[o,kh(o)]}function xh(e){let t=kh(e);return[Sh(e),t,Sh(t)]}function Sh(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ch=[`left`,`right`],wh=[`right`,`left`],Th=[`top`,`bottom`],Eh=[`bottom`,`top`];function Dh(e,t,n){switch(e){case`top`:case`bottom`:return n?t?wh:Ch:t?Ch:wh;case`left`:case`right`:return t?Th:Eh;default:return[]}}function Oh(e,t,n,r){let i=hh(e),a=Dh(mh(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Sh)))),a}function kh(e){let t=mh(e);return dh[t]+e.slice(t.length)}function Ah(e){return{top:0,right:0,bottom:0,left:0,...e}}function jh(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ah(e)}function Mh(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Nh(e,t,n){let{reference:r,floating:i}=e,a=vh(t),o=yh(t),s=_h(o),c=mh(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(hh(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ph(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ph(t,e),p=jh(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Mh(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Mh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Fh=50,Ih=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ph},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Nh(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ph(e,t)||{};if(l==null)return{};let d=jh(u),f={x:n,y:r},p=yh(i),m=_h(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=oh(d[_],T),D=oh(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=fh(O,A,k),M=!c.arrow&&hh(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==vh(t))||T.every(e=>vh(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vh(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},zh=new Set([`left`,`top`]);async function Bh(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=mh(n),s=hh(n),c=vh(n)===`y`,l=zh.has(o)?-1:1,u=a&&c?-1:1,d=ph(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Vh=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Bh(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Hh=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ph(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=vh(mh(i)),p=gh(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=fh(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=fh(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Uh=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ph(e,t),u={x:n,y:r},d=vh(i),f=gh(d),p=u[f],m=u[d],h=ph(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=zh.has(mh(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Wh=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=ph(e,t),u=await o.detectOverflow(t,l),d=mh(i),f=hh(i),p=vh(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=oh(h-u[g],v),x=oh(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=sh(u.left,0),t=sh(u.right,0),n=sh(u.top,0),r=sh(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:sh(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:sh(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Gh(){return typeof window<`u`}function Kh(e){return Yh(e)?(e.nodeName||``).toLowerCase():`#document`}function qh(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Jh(e){return((Yh(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Yh(e){return Gh()?e instanceof Node||e instanceof qh(e).Node:!1}function Xh(e){return Gh()?e instanceof Element||e instanceof qh(e).Element:!1}function Zh(e){return Gh()?e instanceof HTMLElement||e instanceof qh(e).HTMLElement:!1}function Qh(e){return!Gh()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof qh(e).ShadowRoot}function $h(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ug(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function eg(e){return/^(table|td|th)$/.test(Kh(e))}function tg(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ng=/transform|translate|scale|rotate|perspective|filter/,rg=/paint|layout|strict|content/,ig=e=>!!e&&e!==`none`,ag;function og(e){let t=Xh(e)?ug(e):e;return ig(t.transform)||ig(t.translate)||ig(t.scale)||ig(t.rotate)||ig(t.perspective)||!cg()&&(ig(t.backdropFilter)||ig(t.filter))||ng.test(t.willChange||``)||rg.test(t.contain||``)}function sg(e){let t=fg(e);for(;Zh(t)&&!lg(t);){if(og(t))return t;if(tg(t))return null;t=fg(t)}return null}function cg(){return ag??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ag}function lg(e){return/^(html|body|#document)$/.test(Kh(e))}function ug(e){return qh(e).getComputedStyle(e)}function dg(e){return Xh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fg(e){if(Kh(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Qh(e)&&e.host||Jh(e);return Qh(t)?t.host:t}function pg(e){let t=fg(e);return lg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zh(t)&&$h(t)?t:pg(t)}function mg(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pg(e),i=r===e.ownerDocument?.body,a=qh(r);if(i){let e=hg(a);return t.concat(a,a.visualViewport||[],$h(r)?r:[],e&&n?mg(e):[])}else return t.concat(r,mg(r,[],n))}function hg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gg(e){let t=ug(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Zh(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ch(n)!==a||ch(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _g(e){return Xh(e)?e:e.contextElement}function vg(e){let t=_g(e);if(!Zh(t))return uh(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gg(t),o=(a?ch(n.width):n.width)/r,s=(a?ch(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var yg=uh(0);function bg(e){let t=qh(e);return!cg()||!t.visualViewport?yg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qh(e)?!1:t}function Sg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_g(e),o=uh(1);t&&(r?Xh(r)&&(o=vg(r)):o=vg(e));let s=xg(a,n,r)?bg(a):uh(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=qh(a),t=r&&Xh(r)?qh(r):r,n=e,i=hg(n);for(;i&&r&&t!==n;){let e=vg(i),t=i.getBoundingClientRect(),r=ug(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=qh(i),i=hg(n)}}return Mh({width:u,height:d,x:c,y:l})}function Cg(e,t){let n=dg(e).scrollLeft;return t?t.left+n:Sg(Jh(e)).left+n}function wg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Cg(e,n),y:n.top+t.scrollTop}}function Tg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Jh(r),s=t?tg(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=uh(1),u=uh(0),d=Zh(r);if((d||!d&&!a)&&((Kh(r)!==`body`||$h(o))&&(c=dg(r)),d)){let e=Sg(r);l=vg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wg(o,c):uh(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Eg(e){return Array.from(e.getClientRects())}function Dg(e){let t=Jh(e),n=dg(e),r=e.ownerDocument.body,i=sh(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=sh(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Cg(e),s=-n.scrollTop;return ug(r).direction===`rtl`&&(o+=sh(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Og=25;function kg(e,t){let n=qh(e),r=Jh(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=cg();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Cg(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Og&&(a-=o)}else l<=Og&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ag(e,t){let n=Sg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Zh(e)?vg(e):uh(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function jg(e,t,n){let r;if(t===`viewport`)r=kg(e,n);else if(t===`document`)r=Dg(Jh(e));else if(Xh(t))r=Ag(t,n);else{let n=bg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Mh(r)}function Mg(e,t){let n=fg(e);return n===t||!Xh(n)||lg(n)?!1:ug(n).position===`fixed`||Mg(n,t)}function Ng(e,t){let n=t.get(e);if(n)return n;let r=mg(e,[],!1).filter(e=>Xh(e)&&Kh(e)!==`body`),i=null,a=ug(e).position===`fixed`,o=a?fg(e):e;for(;Xh(o)&&!lg(o);){let t=ug(o),n=og(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||$h(o)&&!n&&Mg(e,o))?r=r.filter(e=>e!==o):i=t,o=fg(o)}return t.set(e,r),r}function Pg(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?tg(t)?[]:Ng(t,this._c):[].concat(n),r],o=jg(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!Ug(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Gg(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_g(e),u=i||a?[...l?mg(l):[],...t?mg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Wg(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Sg(e):null;c&&g();function g(){let t=Sg(e);h&&!Ug(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Kg=Vh,qg=Hh,Jg=Rh,Yg=Wh,Xg=Lh,Zg=Uh,Qg=(e,t,n)=>{let r=new Map,i={platform:Hg,...n},a={...i.platform,_c:r};return Ih(e,t,{...i,platform:a})},$g=`div`;function e_(e=0,t=0,n=0,r=0){if(typeof DOMRect==`function`)return new DOMRect(e,t,n,r);let i={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return{...i,toJSON:()=>i}}function t_(e){if(!e)return e_();let{x:t,y:n,width:r,height:i}=e;return e_(t,n,r,i)}function n_(e,t){return{contextElement:e||void 0,getBoundingClientRect:()=>{let n=e,r=t?.(n);return r||!n?t_(r):n.getBoundingClientRect()}}}function r_(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function i_(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}function a_(e,t){return Kg(({placement:n})=>{let r=(e?.clientHeight||0)/2,i=typeof t.gutter==`number`?t.gutter+r:t.gutter??r;return{crossAxis:n.split(`-`)[1]?void 0:t.shift,mainAxis:i,alignmentAxis:t.shift}})}function o_(e){if(e.flip===!1)return;let t=typeof e.flip==`string`?e.flip.split(` `):void 0;return Kl(!t||t.every(r_),!1),Jg({padding:e.overflowPadding,fallbackPlacements:t})}function s_(e){if(!(!e.slide&&!e.overlap))return qg({mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Zg()})}function c_(e){return Yg({padding:e.overflowPadding,apply({elements:t,availableWidth:n,availableHeight:r,rects:i}){let a=t.floating,o=Math.round(i.reference.width);n=Math.floor(n),r=Math.floor(r),a.style.setProperty(`--popover-anchor-width`,`${o}px`),a.style.setProperty(`--popover-available-width`,`${n}px`),a.style.setProperty(`--popover-available-height`,`${r}px`),e.sameWidth&&(a.style.width=`${o}px`),e.fitViewport&&(a.style.maxWidth=`${n}px`,a.style.maxHeight=`${r}px`)}})}function l_(e,t){if(e)return Xg({element:e,padding:t.arrowPadding})}var u_=ld(function({store:e,modal:t=!1,portal:n=!!t,preserveTabOrder:r=!0,autoFocusOnShow:i=!0,wrapperProps:a,fixed:o=!1,flip:s=!0,shift:c=0,slide:l=!0,overlap:u=!1,sameWidth:d=!1,fitViewport:f=!1,gutter:p,arrowPadding:m=4,overflowPadding:h=8,getAnchorRect:g,updatePosition:_,...v}){let y=bp();e||=y,Kl(e,!1);let b=e.useState(`arrowElement`),x=e.useState(`anchorElement`),S=e.useState(`disclosureElement`),C=e.useState(`popoverElement`),w=e.useState(`contentElement`),T=e.useState(`placement`),E=e.useState(`mounted`),D=e.useState(`rendered`),O=(0,V.useRef)(null),[k,A]=(0,V.useState)(!1),{portalRef:j,domReady:M}=Xu(n,v.portalRef),ee=Q(g),N=Q(_),P=!!_;Z(()=>{if(!C?.isConnected)return;C.style.setProperty(`--popover-overflow-padding`,`${h}px`);let t=n_(x,ee),n=async()=>{if(!E)return;b||(O.current=O.current||document.createElement(`div`));let n=b||O.current,r=[a_(n,{gutter:p,shift:c}),o_({flip:s,overflowPadding:h}),s_({slide:l,shift:c,overlap:u,overflowPadding:h}),l_(n,{arrowPadding:m}),c_({sameWidth:d,fitViewport:f,overflowPadding:h})],i=await Qg(t,C,{placement:T,strategy:o?`fixed`:`absolute`,middleware:r});e?.setState(`currentPlacement`,i.placement),A(!0);let a=i_(i.x),g=i_(i.y);if(Object.assign(C.style,{top:`0`,left:`0`,transform:`translate3d(${a}px,${g}px,0)`}),n&&i.middlewareData.arrow){let{x:e,y:t}=i.middlewareData.arrow,r=i.placement.split(`-`)[0],a=n.clientWidth/2,o=n.clientHeight/2,s=e==null?-a:e+a,c=t==null?-o:t+o;C.style.setProperty(`--popover-transform-origin`,{top:`${s}px calc(100% + ${o}px)`,bottom:`${s}px ${-o}px`,left:`calc(100% + ${a}px) ${c}px`,right:`${-a}px ${c}px`}[r]),Object.assign(n.style,{left:e==null?``:`${e}px`,top:t==null?``:`${t}px`,[r]:`100%`})}},r=Gg(t,C,async()=>{P?(await N({updatePosition:n}),A(!0)):await n()},{elementResize:typeof ResizeObserver==`function`});return()=>{A(!1),r()}},[e,D,C,b,x,C,T,E,M,o,s,c,l,u,d,f,p,m,h,ee,P,N]),Z(()=>{if(!E||!M||!C?.isConnected||!w?.isConnected)return;let e=()=>{C.style.zIndex=getComputedStyle(w).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[E,M,C,w]);let F=o?`fixed`:`absolute`;return v=Yu(v,t=>(0,U.jsx)(`div`,{...a,style:{position:F,top:0,left:0,width:`max-content`,...a?.style},ref:e?.setPopoverElement,children:t}),[e,F,a]),v=Yu(v,t=>(0,U.jsx)(Sp,{value:e,children:t}),[e]),v={"data-placing":!k||void 0,...v,style:{position:`relative`,...v.style}},v=ih({store:e,modal:t,portal:n,preserveTabOrder:r,preserveTabOrderAnchor:S||x,autoFocusOnShow:k&&i,...v,portalRef:j}),v});ah(od(function(e){return cd($g,u_(e))}),bp);function d_({popover:e,...t}={}){let n=kf(t.store,Df(e,[`arrowElement`,`anchorElement`,`contentElement`,`popoverElement`,`disclosureElement`])),r=n?.getState(),i=Zm({...t,store:n}),a=X(t.placement,r?.placement,`bottom`),o=xf({...i.getState(),placement:a,currentPlacement:a,anchorElement:X(r?.anchorElement,null),popoverElement:X(r?.popoverElement,null),arrowElement:X(r?.arrowElement,null),rendered:Symbol(`rendered`)},i,n);return{...i,...o,setAnchorElement:e=>o.setState(`anchorElement`,e),setPopoverElement:e=>o.setState(`popoverElement`,e),setArrowElement:e=>o.setState(`arrowElement`,e),render:()=>o.setState(`rendered`,Symbol(`rendered`))}}function f_(e,t,n){return Gu(t,[n.popover]),Pf(e,n,`placement`),Qm(e,t,n)}var p_=`div`,m_=ld(function({store:e,...t}){let n=bp();return e||=n,t={...t,ref:Vu(e?.setAnchorElement,t.ref)},t});od(function(e){return cd(p_,m_(e))});var h_=(0,V.createContext)(void 0),g_=`div`,__=ld(function(e){let[t,n]=(0,V.useState)();return e=Yu(e,e=>(0,U.jsx)(h_.Provider,{value:n,children:e}),[]),e={role:`group`,"aria-labelledby":t,...e},Xl(e)});od(function(e){return cd(g_,__(e))});var v_=`div`,y_=ld(function({store:e,...t}){return t=__(t),t});od(function(e){return cd(v_,y_(e))});var b_=`div`,x_=ld(function(e){let t=(0,V.useContext)(h_),n=Hu(e.id);return Z(()=>(t?.(n),()=>t?.(void 0)),[t,n]),e={id:n,"aria-hidden":!0,...e},Xl(e)});od(function(e){return cd(b_,x_(e))});var S_=`div`,C_=ld(function({store:e,...t}){return t=x_(t),t});od(function(e){return cd(S_,C_(e))});var w_=`div`;function T_(e){let t=e.relatedTarget;return t?.nodeType===Node.ELEMENT_NODE?t:null}function E_(e){let t=T_(e);return t?ou(e.currentTarget,t):!1}var D_=Symbol(`composite-hover`);function O_(e){let t=T_(e);if(!t)return!1;do{if(Bl(t,D_)&&t[D_])return!0;t=t.parentElement}while(t);return!1}var k_=ld(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:n=!!t,...r}){let i=gd();e||=i,Kl(e,!1);let a=$u(),o=r.onMouseMove,s=Ju(t),c=Q(t=>{if(o?.(t),!t.defaultPrevented&&a()&&s(t)){if(!Gd(t.currentTarget)){let t=e?.getState().baseElement;t&&!Wd(t)&&t.focus()}e?.setActiveId(t.currentTarget.id)}}),l=r.onMouseLeave,u=Ju(n),d=Q(t=>{var n;l?.(t),!t.defaultPrevented&&a()&&(E_(t)||O_(t)||s(t)&&u(t)&&(e?.setActiveId(null),(n=e?.getState().baseElement)==null||n.focus()))}),f=(0,V.useCallback)(e=>{e&&(e[D_]=!0)},[]);return r={...r,ref:Vu(f,r.ref),onMouseMove:c,onMouseLeave:d},Xl(r)});sd(od(function(e){return cd(w_,k_(e))}));var A_=`input`;function j_(e,t,n){return n?e.find(e=>!e.disabled&&e.value)?.value===t:!1}function M_(e,t){return!t||e==null?!1:(e=Hl(e),t.length>e.length&&t.toLowerCase().indexOf(e.toLowerCase())===0)}function N_(e){return e.type===`input`}function P_(e){return e===`inline`||e===`list`||e===`both`||e===`none`}function F_(e){return e.find(e=>e.disabled?!1:e.element?.getAttribute(`role`)!==`tab`)?.id}var I_=ld(function({store:e,focusable:t=!0,autoSelect:n=!1,getAutoSelectId:r,setValueOnChange:i,showMinLength:a=0,showOnChange:o,showOnMouseDown:s,showOnClick:c=s,showOnKeyDown:l,showOnKeyPress:u=l,blurActiveItemOnClick:d,setValueOnClick:f=!0,moveOnKeyPress:p=!0,autoComplete:m=`list`,...h}){let g=Wp();e||=g,Kl(e,!1);let _=(0,V.useRef)(null),[v,y]=qu(),b=(0,V.useRef)(!1),x=(0,V.useRef)(!1),S=e.useState(e=>e.virtualFocus&&n),C=m===`inline`||m===`both`,[w,T]=(0,V.useState)(C);Ku(()=>{C&&T(!0)},[C]);let E=e.useState(`value`),D=(0,V.useRef)(void 0);(0,V.useEffect)(()=>Tf(e,[`selectedValue`,`activeId`],(e,t)=>{D.current=t.selectedValue}),[]);let O=e.useState(e=>{if(C&&w&&!(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||D.current?.includes(e.activeValue))))return e.activeValue}),k=e.useState(`renderedItems`),A=e.useState(`open`),j=e.useState(`contentElement`),M=(0,V.useMemo)(()=>!C||!w?E:j_(k,O,S)?M_(E,O)?E+(O?.slice(E.length)||``):E:O||E,[C,w,k,O,S,E]);(0,V.useEffect)(()=>{let e=_.current;if(!e)return;let t=()=>T(!0);return e.addEventListener(`combobox-item-move`,t),()=>{e.removeEventListener(`combobox-item-move`,t)}},[]),(0,V.useEffect)(()=>{if(!C||!w||!O||!j_(k,O,S)||!M_(E,O))return;let e=Rl;return queueMicrotask(()=>{let t=_.current;if(!t)return;let{start:n,end:r}=mu(t),i=E.length,a=O.length;_u(t,i,a),e=()=>{if(!Wd(t))return;let{start:e,end:o}=mu(t);e===i&&o===a&&_u(t,n,r)}}),()=>e()},[v,C,w,O,k,S,E]);let ee=(0,V.useRef)(null),N=Q(r),P=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!A||!j)return;let t=gu(j);if(!t)return;ee.current=t;let n=()=>{b.current=!1},r=()=>{if(!e||!b.current)return;let{activeId:t}=e.getState();t!==null&&t!==P.current&&(b.current=!1)},i={passive:!0,capture:!0};return t.addEventListener(`wheel`,n,i),t.addEventListener(`touchmove`,n,i),t.addEventListener(`scroll`,r,i),()=>{t.removeEventListener(`wheel`,n,!0),t.removeEventListener(`touchmove`,n,!0),t.removeEventListener(`scroll`,r,!0)}},[A,j,e]),Z(()=>{E&&(x.current||(b.current=!0))},[E]),Z(()=>{S!==`always`&&A||(b.current=A)},[S,A]);let F=e.useState(`resetValueOnSelect`);Gu(()=>{let t=b.current;if(!e||!A||!t&&!F)return;let{baseElement:n,contentElement:r,activeId:i}=e.getState();if(!(n&&!Wd(n))){if(r?.hasAttribute(`data-placing`)){let e=new MutationObserver(y);return e.observe(r,{attributeFilter:[`data-placing`]}),()=>e.disconnect()}if(S&&t){let t=N(k),n=t===void 0?F_(k)??e.first():t;P.current=n,e.move(n??null)}else{let t=e.item(i||e.first())?.element;t&&`scrollIntoView`in t&&t.scrollIntoView({block:`nearest`,inline:`nearest`})}}},[e,A,v,E,S,F,N,k]),(0,V.useEffect)(()=>{if(!C)return;let t=_.current;if(!t)return;let n=[t,j].filter(e=>!!e),r=t=>{n.every(e=>Mu(t,e))&&e?.setValue(M)};for(let e of n)e.addEventListener(`focusout`,r);return()=>{for(let e of n)e.removeEventListener(`focusout`,r)}},[C,j,e,M]);let te=e=>e.currentTarget.value.length>=a,I=h.onChange,ne=Ju(o??te),L=Ju(i??!e.tag),R=Q(t=>{if(I?.(t),t.defaultPrevented||!e)return;let n=t.currentTarget,{value:r,selectionStart:i,selectionEnd:a}=n,o=t.nativeEvent;if(b.current=!0,N_(o)&&(o.isComposing&&(b.current=!1,x.current=!0),C)){let e=o.inputType===`insertText`||o.inputType===`insertCompositionText`,t=i===r.length;T(e&&t)}if(L(t)){let t=r===e.getState().value;e.setValue(r),queueMicrotask(()=>{_u(n,i,a)}),C&&S&&t&&y()}ne(t)&&e.show(),(!S||!b.current)&&e.setActiveId(null)}),re=h.onCompositionEnd,z=Q(e=>{b.current=!0,x.current=!1,re?.(e),!e.defaultPrevented&&S&&y()}),B=h.onMouseDown,ie=Ju(d??(()=>!!e?.getState().includesBaseElement)),H=Ju(f),ae=Ju(c??te),oe=Q(t=>{B?.(t),!t.defaultPrevented&&(t.button||t.ctrlKey||e&&(ie(t)&&e.setActiveId(null),H(t)&&e.setValue(M),ae(t)&&Nu(t.currentTarget,`mouseup`,e.show)))}),se=h.onKeyDown,ce=Ju(u??te),le=Q(t=>{if(se?.(t),t.repeat||(b.current=!1),t.defaultPrevented||t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||!e)return;let{open:n}=e.getState();n||(t.key===`ArrowUp`||t.key===`ArrowDown`)&&ce(t)&&(t.preventDefault(),e.show())}),ue=h.onBlur,de=Q(e=>{b.current=!1,ue?.(e),e.defaultPrevented}),fe=Hu(h.id),pe=P_(m)?m:void 0,me=e.useState(e=>e.activeId===null);return h={id:fe,role:`combobox`,"aria-autocomplete":pe,"aria-haspopup":hu(j,`listbox`),"aria-expanded":A,"aria-controls":j?.id,"data-active-item":me||void 0,value:M,...h,ref:Vu(_,h.ref),onChange:R,onCompositionEnd:z,onMouseDown:oe,onKeyDown:le,onBlur:de},h=Qf({store:e,focusable:t,...h,moveOnKeyPress:e=>Jl(p,e)?!1:(C&&T(!0),!0)}),h=m_({store:e,...h}),{autoComplete:`off`,...h}}),L_=od(function(e){return cd(A_,I_(e))}),R_=`div`,z_=ld(function({store:e,...t}){let n=Up();return e||=n,Kl(e,!1),hu(e.useState(`contentElement`))===`grid`&&(t={role:`rowgroup`,...t}),t=y_({store:e,...t}),t}),B_=od(function(e){return cd(R_,z_(e))}),V_=`div`,H_=ld(function(e){return e=C_(e),e}),U_=od(function(e){return cd(V_,H_(e))}),W_=`div`;function G_(e,t){if(t!=null)return e==null?!1:Array.isArray(e)?e.includes(t):e===t}function K_(e){return{menu:`menuitem`,listbox:`option`,tree:`treeitem`}[e]??`option`}var q_=ld(function({store:e,value:t,hideOnClick:n,setValueOnClick:r,selectValueOnClick:i=!0,resetValueOnSelect:a,focusOnHover:o=!1,moveOnKeyPress:s=!0,getItem:c,...l}){let u=Up();e||=u,Kl(e,!1);let{resetValueOnSelectState:d,multiSelectable:f,selected:p}=Nf(e,{resetValueOnSelectState:`resetValueOnSelect`,multiSelectable(e){return Array.isArray(e.selectedValue)},selected(e){return G_(e.selectedValue,t)}}),m=(0,V.useCallback)(e=>{let n={...e,value:t};return c?c(n):n},[t,c]);r??=!f,n??=t!=null&&!f;let h=l.onClick,g=Ju(r),_=Ju(i),v=Ju(a??d??f),y=Ju(n),b=Q(n=>{h?.(n),!n.defaultPrevented&&(Ou(n)||Du(n)||(t!=null&&(_(n)&&(v(n)&&e?.resetValue(),e?.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),g(n)&&e?.setValue(t)),y(n)&&e?.hide()))}),x=l.onKeyDown,S=Q(t=>{if(x?.(t),t.defaultPrevented)return;let n=e?.getState().baseElement;n&&(Wd(n)||(t.key.length===1||t.key===`Backspace`||t.key===`Delete`)&&(queueMicrotask(()=>n.focus()),du(n)&&e?.setValue(n.value)))});f&&p!=null&&(l={"aria-selected":p,...l}),l=Yu(l,e=>(0,U.jsx)(qp.Provider,{value:t,children:(0,U.jsx)(Jp.Provider,{value:p??!1,children:e})}),[t,p]),l={role:K_((0,V.useContext)(Bp)),children:t,...l,onClick:b,onKeyDown:S};let C=Ju(s);return l=Hf({store:e,...l,getItem:m,moveOnKeyPress:t=>{if(!C(t))return!1;let n=new Event(`combobox-item-move`);return(e?.getState().baseElement)?.dispatchEvent(n),!0}}),l=k_({store:e,focusOnHover:o,...l}),l}),J_=sd(od(function(e){return cd(W_,q_(e))})),Y_=`div`,X_=ld(function({store:e,alwaysVisible:t,...n}){let r=Up(!0),i=Hp();e||=i;let a=!!e&&e===r;Kl(e,!1);let o=(0,V.useRef)(null),s=Hu(n.id),c=e.useState(`mounted`),l=pp(c,n.hidden,t),u=l?{...n.style,display:`none`}:n.style,d=e.useState(e=>Array.isArray(e.selectedValue)),f=Wu(o,`role`,n.role),p=(f===`listbox`||f===`tree`||f===`grid`)&&d||void 0,[m,h]=(0,V.useState)(!1),g=e.useState(`contentElement`);Z(()=>{if(!c)return;let e=o.current;if(!e||g!==e)return;let t=()=>{h(!!e.querySelector(`[role='listbox']`))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:[`role`]}),t(),()=>n.disconnect()},[c,g]),m||(n={role:`listbox`,"aria-multiselectable":p,...n}),n=Yu(n,t=>(0,U.jsx)(Kp,{value:e,children:(0,U.jsx)(Bp.Provider,{value:f,children:t})}),[e,f]);let _=s&&(!r||!a)?e.setContentElement:null;return n={id:s,hidden:l,...n,ref:Vu(_,o,n.ref),style:u},Xl(n)}),Z_=od(function(e){return cd(Y_,X_(e))}),Q_=`div`;function $_(e,...t){if(!e)return!1;if(`id`in e){let n=t.filter(Boolean).map(e=>`[aria-controls~="${e}"]`).join(`, `);return n?e.matches(n):!1}return!1}var ev=ld(function({store:e,modal:t,tabIndex:n,alwaysVisible:r,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...o}){let s=Wp();e||=s,Kl(e,!1);let c=e.useState(`baseElement`),l=(0,V.useRef)(!1),u=Mf(e.tag,e=>e?.renderedItems.length);return o=X_({store:e,alwaysVisible:r,...o}),o=u_({store:e,modal:t,alwaysVisible:r,backdrop:!1,autoFocusOnShow:!1,finalFocus:c,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:u,...o,getPersistentElements(){let n=o.getPersistentElements?.call(o)||[];if(!t||!e)return n;let{contentElement:r,baseElement:i}=e.getState();if(!i)return n;let a=ru(i),s=[];if(r?.id&&s.push(`[aria-controls~="${r.id}"]`),i?.id&&s.push(`[aria-controls~="${i.id}"]`),!s.length)return[...n,i];let c=s.join(`,`),l=a.querySelectorAll(c);return[...n,...l]},autoFocusOnHide(e){return Jl(i,e)?!1:l.current?(l.current=!1,!1):!0},hideOnInteractOutside(t){let n=e?.getState(),r=n?.contentElement?.id,i=n?.baseElement?.id;if($_(t.target,r,i))return!1;let o=typeof a==`function`?a(t):a;return o&&(l.current=t.type===`click`),o}}),o}),tv=ah(od(function(e){return cd(Q_,ev(e))}),Wp);(0,V.createContext)(null),(0,V.createContext)(null);var nv=ud([vd],[$]),rv=nv.useContext;nv.useScopedContext,nv.useProviderContext,nv.ContextProvider,nv.ScopedContextProvider;var iv=Su()&&bu();function av({tag:e,...t}={}){let n=kf(t.store,Of(e,[`value`,`rtl`])),r=e?.getState(),i=n?.getState(),a=X(t.activeId,i?.activeId,t.defaultActiveId,null),o=Lp({...t,activeId:a,includesBaseElement:X(t.includesBaseElement,i?.includesBaseElement,!0),orientation:X(t.orientation,i?.orientation,`vertical`),focusLoop:X(t.focusLoop,i?.focusLoop,!0),focusWrap:X(t.focusWrap,i?.focusWrap,!0),virtualFocus:X(t.virtualFocus,i?.virtualFocus,!0)}),s=d_({...t,placement:X(t.placement,i?.placement,`bottom-start`)}),c=X(t.value,i?.value,t.defaultValue,``),l=X(t.selectedValue,i?.selectedValue,r?.values,t.defaultSelectedValue,``),u=Array.isArray(l),d={...o.getState(),...s.getState(),value:c,selectedValue:l,resetValueOnSelect:X(t.resetValueOnSelect,i?.resetValueOnSelect,u),resetValueOnHide:X(t.resetValueOnHide,i?.resetValueOnHide,u&&!e),activeValue:i?.activeValue},f=xf(d,o,s,n);return iv&&Sf(f,()=>Tf(f,[`virtualFocus`],()=>{f.setState(`virtualFocus`,!1)})),Sf(f,()=>{if(e)return Vl(Tf(f,[`selectedValue`],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),Tf(e,[`values`],e=>{f.setState(`selectedValue`,e.values)}))}),Sf(f,()=>Tf(f,[`resetValueOnHide`,`mounted`],e=>{e.resetValueOnHide&&(e.mounted||f.setState(`value`,c))})),Sf(f,()=>Tf(f,[`open`],e=>{e.open||(f.setState(`activeId`,a),f.setState(`moves`,0))})),Sf(f,()=>Tf(f,[`moves`,`activeId`],(e,t)=>{e.moves===t.moves&&f.setState(`activeValue`,void 0)})),Sf(f,()=>Ef(f,[`moves`,`renderedItems`],(e,t)=>{if(e.moves===t.moves)return;let{activeId:n}=f.getState(),r=o.item(n);f.setState(`activeValue`,r?.value)})),{...s,...o,...f,tag:e,setValue:e=>f.setState(`value`,e),resetValue:()=>f.setState(`value`,d.value),setSelectedValue:e=>f.setState(`selectedValue`,e)}}function ov(e){let t=rv();return e={...e,tag:e.tag===void 0?t:e.tag},Rp(e)}function sv(e,t,n){return Gu(t,[n.tag]),Pf(e,n,`value`,`setValue`),Pf(e,n,`selectedValue`,`setSelectedValue`),Pf(e,n,`resetValueOnHide`),Pf(e,n,`resetValueOnSelect`),Object.assign(zp(f_(e,t,n),t,n),{tag:n.tag})}function cv(e={}){e=ov(e);let[t,n]=Ff(av,e);return sv(t,n,e)}function lv(e={}){return(0,U.jsx)(Gp,{value:cv(e),children:e.children})}var uv=e(t(((e,t)=>{var n={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,Ấ:`A`,Ắ:`A`,Ẳ:`A`,Ẵ:`A`,Ặ:`A`,Æ:`AE`,Ầ:`A`,Ằ:`A`,Ȃ:`A`,Ả:`A`,Ạ:`A`,Ẩ:`A`,Ẫ:`A`,Ậ:`A`,Ç:`C`,Ḉ:`C`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,Ế:`E`,Ḗ:`E`,Ề:`E`,Ḕ:`E`,Ḝ:`E`,Ȇ:`E`,Ẻ:`E`,Ẽ:`E`,Ẹ:`E`,Ể:`E`,Ễ:`E`,Ệ:`E`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,Ḯ:`I`,Ȋ:`I`,Ỉ:`I`,Ị:`I`,Ð:`D`,Ñ:`N`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,Ố:`O`,Ṍ:`O`,Ṓ:`O`,Ȏ:`O`,Ỏ:`O`,Ọ:`O`,Ổ:`O`,Ỗ:`O`,Ộ:`O`,Ờ:`O`,Ở:`O`,Ỡ:`O`,Ớ:`O`,Ợ:`O`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,Ủ:`U`,Ụ:`U`,Ử:`U`,Ữ:`U`,Ự:`U`,Ý:`Y`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,ấ:`a`,ắ:`a`,ẳ:`a`,ẵ:`a`,ặ:`a`,æ:`ae`,ầ:`a`,ằ:`a`,ȃ:`a`,ả:`a`,ạ:`a`,ẩ:`a`,ẫ:`a`,ậ:`a`,ç:`c`,ḉ:`c`,è:`e`,é:`e`,ê:`e`,ë:`e`,ế:`e`,ḗ:`e`,ề:`e`,ḕ:`e`,ḝ:`e`,ȇ:`e`,ẻ:`e`,ẽ:`e`,ẹ:`e`,ể:`e`,ễ:`e`,ệ:`e`,ì:`i`,í:`i`,î:`i`,ï:`i`,ḯ:`i`,ȋ:`i`,ỉ:`i`,ị:`i`,ð:`d`,ñ:`n`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,ố:`o`,ṍ:`o`,ṓ:`o`,ȏ:`o`,ỏ:`o`,ọ:`o`,ổ:`o`,ỗ:`o`,ộ:`o`,ờ:`o`,ở:`o`,ỡ:`o`,ớ:`o`,ợ:`o`,ù:`u`,ú:`u`,û:`u`,ü:`u`,ủ:`u`,ụ:`u`,ử:`u`,ữ:`u`,ự:`u`,ý:`y`,ÿ:`y`,Ā:`A`,ā:`a`,Ă:`A`,ă:`a`,Ą:`A`,ą:`a`,Ć:`C`,ć:`c`,Ĉ:`C`,ĉ:`c`,Ċ:`C`,ċ:`c`,Č:`C`,č:`c`,C̆:`C`,c̆:`c`,Ď:`D`,ď:`d`,Đ:`D`,đ:`d`,Ē:`E`,ē:`e`,Ĕ:`E`,ĕ:`e`,Ė:`E`,ė:`e`,Ę:`E`,ę:`e`,Ě:`E`,ě:`e`,Ĝ:`G`,Ǵ:`G`,ĝ:`g`,ǵ:`g`,Ğ:`G`,ğ:`g`,Ġ:`G`,ġ:`g`,Ģ:`G`,ģ:`g`,Ĥ:`H`,ĥ:`h`,Ħ:`H`,ħ:`h`,Ḫ:`H`,ḫ:`h`,Ĩ:`I`,ĩ:`i`,Ī:`I`,ī:`i`,Ĭ:`I`,ĭ:`i`,Į:`I`,į:`i`,İ:`I`,ı:`i`,IJ:`IJ`,ij:`ij`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,Ḱ:`K`,ḱ:`k`,K̆:`K`,k̆:`k`,Ĺ:`L`,ĺ:`l`,Ļ:`L`,ļ:`l`,Ľ:`L`,ľ:`l`,Ŀ:`L`,ŀ:`l`,Ł:`l`,ł:`l`,Ḿ:`M`,ḿ:`m`,M̆:`M`,m̆:`m`,Ń:`N`,ń:`n`,Ņ:`N`,ņ:`n`,Ň:`N`,ň:`n`,ʼn:`n`,N̆:`N`,n̆:`n`,Ō:`O`,ō:`o`,Ŏ:`O`,ŏ:`o`,Ő:`O`,ő:`o`,Œ:`OE`,œ:`oe`,P̆:`P`,p̆:`p`,Ŕ:`R`,ŕ:`r`,Ŗ:`R`,ŗ:`r`,Ř:`R`,ř:`r`,R̆:`R`,r̆:`r`,Ȓ:`R`,ȓ:`r`,Ś:`S`,ś:`s`,Ŝ:`S`,ŝ:`s`,Ş:`S`,Ș:`S`,ș:`s`,ş:`s`,Š:`S`,š:`s`,Ţ:`T`,ţ:`t`,ț:`t`,Ț:`T`,Ť:`T`,ť:`t`,Ŧ:`T`,ŧ:`t`,T̆:`T`,t̆:`t`,Ũ:`U`,ũ:`u`,Ū:`U`,ū:`u`,Ŭ:`U`,ŭ:`u`,Ů:`U`,ů:`u`,Ű:`U`,ű:`u`,Ų:`U`,ų:`u`,Ȗ:`U`,ȗ:`u`,V̆:`V`,v̆:`v`,Ŵ:`W`,ŵ:`w`,Ẃ:`W`,ẃ:`w`,X̆:`X`,x̆:`x`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Y̆:`Y`,y̆:`y`,Ź:`Z`,ź:`z`,Ż:`Z`,ż:`z`,Ž:`Z`,ž:`z`,ſ:`s`,ƒ:`f`,Ơ:`O`,ơ:`o`,Ư:`U`,ư:`u`,Ǎ:`A`,ǎ:`a`,Ǐ:`I`,ǐ:`i`,Ǒ:`O`,ǒ:`o`,Ǔ:`U`,ǔ:`u`,Ǖ:`U`,ǖ:`u`,Ǘ:`U`,ǘ:`u`,Ǚ:`U`,ǚ:`u`,Ǜ:`U`,ǜ:`u`,Ứ:`U`,ứ:`u`,Ṹ:`U`,ṹ:`u`,Ǻ:`A`,ǻ:`a`,Ǽ:`AE`,ǽ:`ae`,Ǿ:`O`,ǿ:`o`,Þ:`TH`,þ:`th`,Ṕ:`P`,ṕ:`p`,Ṥ:`S`,ṥ:`s`,X́:`X`,x́:`x`,Ѓ:`Г`,ѓ:`г`,Ќ:`К`,ќ:`к`,A̋:`A`,a̋:`a`,E̋:`E`,e̋:`e`,I̋:`I`,i̋:`i`,Ǹ:`N`,ǹ:`n`,Ồ:`O`,ồ:`o`,Ṑ:`O`,ṑ:`o`,Ừ:`U`,ừ:`u`,Ẁ:`W`,ẁ:`w`,Ỳ:`Y`,ỳ:`y`,Ȁ:`A`,ȁ:`a`,Ȅ:`E`,ȅ:`e`,Ȉ:`I`,ȉ:`i`,Ȍ:`O`,ȍ:`o`,Ȑ:`R`,ȑ:`r`,Ȕ:`U`,ȕ:`u`,B̌:`B`,b̌:`b`,Č̣:`C`,č̣:`c`,Ê̌:`E`,ê̌:`e`,F̌:`F`,f̌:`f`,Ǧ:`G`,ǧ:`g`,Ȟ:`H`,ȟ:`h`,J̌:`J`,ǰ:`j`,Ǩ:`K`,ǩ:`k`,M̌:`M`,m̌:`m`,P̌:`P`,p̌:`p`,Q̌:`Q`,q̌:`q`,Ř̩:`R`,ř̩:`r`,Ṧ:`S`,ṧ:`s`,V̌:`V`,v̌:`v`,W̌:`W`,w̌:`w`,X̌:`X`,x̌:`x`,Y̌:`Y`,y̌:`y`,A̧:`A`,a̧:`a`,B̧:`B`,b̧:`b`,Ḑ:`D`,ḑ:`d`,Ȩ:`E`,ȩ:`e`,Ɛ̧:`E`,ɛ̧:`e`,Ḩ:`H`,ḩ:`h`,I̧:`I`,i̧:`i`,Ɨ̧:`I`,ɨ̧:`i`,M̧:`M`,m̧:`m`,O̧:`O`,o̧:`o`,Q̧:`Q`,q̧:`q`,U̧:`U`,u̧:`u`,X̧:`X`,x̧:`x`,Z̧:`Z`,z̧:`z`,й:`и`,Й:`И`,ё:`е`,Ё:`Е`},r=Object.keys(n).join(`|`),i=new RegExp(r,`g`),a=new RegExp(r,``);function o(e){return n[e]}var s=function(e){return e.replace(i,o)},c=function(e){return!!e.match(a)};t.exports=s,t.exports.has=c,t.exports.remove=s}))()),dv={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},fv=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function pv(e,t,n={}){let{keys:r,threshold:i=dv.MATCHES,baseSort:a=fv,sorter:o=e=>e.sort((e,t)=>yv(e,t,a))}=n;return o(e.reduce(s,[])).map(({item:e})=>e);function s(e,a,o){let s=mv(a,r,t,n),{rank:c,keyThreshold:l=i}=s;return c>=l&&e.push({...s,item:a,index:o}),e}}pv.rankings=dv;function mv(e,t,n,r){if(!t){let t=e;return{rankedValue:t,rank:gv(t,n,r),keyIndex:-1,keyThreshold:r.threshold}}return Cv(e,t).reduce(({rank:e,rankedValue:t,keyIndex:i,keyThreshold:a},{itemValue:o,attributes:s},c)=>{let l=gv(o,n,r),u=t,{minRanking:d,maxRanking:f,threshold:p}=s;return l=dv.MATCHES?l=d:l>f&&(l=f),l>e&&(e=l,i=c,a=p,u=o),{rankedValue:u,rank:e,keyIndex:i,keyThreshold:a}},{rankedValue:e,rank:dv.NO_MATCH,keyIndex:-1,keyThreshold:r.threshold})}function*hv(e,t){let n=-1;for(;(n=e.indexOf(t,n+1))>-1;)yield n;return-1}function gv(e,t,n){if(e=bv(e,n),t=bv(t,n),t.length>e.length)return dv.NO_MATCH;if(e===t)return dv.CASE_SENSITIVE_EQUAL;e=e.toLowerCase(),t=t.toLowerCase();let r=hv(e,t),i=r.next(),a=i.value;if(e.length===t.length&&a===0)return dv.EQUAL;if(a===0)return dv.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&e[o.value-1]===` `)return dv.WORD_STARTS_WITH;o=r.next()}return a>0?dv.CONTAINS:t.length===1?dv.NO_MATCH:_v(e).includes(t)?dv.ACRONYM:vv(e,t)}function _v(e){let t=``,n=` `;for(let r=0;r-1))return dv.NO_MATCH}return a(r-o)}function yv(e,t,n){let{rank:r,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return r===a?i===o?n(e,t):ia?-1:1}function bv(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,uv.default)(e)),e}function xv(e,t){typeof t==`object`&&(t=t.key);let n;if(typeof t==`function`)n=t(e);else if(e==null)n=null;else if(Object.hasOwnProperty.call(e,t))n=e[t];else if(t.includes(`.`))return Sv(t,e);else n=null;return n==null?[]:Array.isArray(n)?n:[String(n)]}function Sv(e,t){let n=e.split(`.`),r=[t];for(let e=0,t=n.length;e{var n=200,r=`Expected a function`,i=`__lodash_hash_undefined__`,a=1,o=2,s=1/0,c=9007199254740991,l=`[object Arguments]`,u=`[object Array]`,d=`[object Boolean]`,f=`[object Date]`,p=`[object Error]`,m=`[object Function]`,h=`[object GeneratorFunction]`,g=`[object Map]`,_=`[object Number]`,v=`[object Object]`,y=`[object Promise]`,b=`[object RegExp]`,x=`[object Set]`,S=`[object String]`,C=`[object Symbol]`,w=`[object WeakMap]`,T=`[object ArrayBuffer]`,E=`[object DataView]`,D=`[object Float32Array]`,O=`[object Float64Array]`,k=`[object Int8Array]`,A=`[object Int16Array]`,j=`[object Int32Array]`,M=`[object Uint8Array]`,ee=`[object Uint8ClampedArray]`,N=`[object Uint16Array]`,P=`[object Uint32Array]`,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,I=/^\./,ne=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,L=/[\\^$.*+?()[\]{}|]/g,R=/\\(\\)?/g,re=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,B={};B[D]=B[O]=B[k]=B[A]=B[j]=B[M]=B[ee]=B[N]=B[P]=!0,B[l]=B[u]=B[T]=B[d]=B[E]=B[f]=B[p]=B[m]=B[g]=B[_]=B[v]=B[b]=B[x]=B[S]=B[w]=!1;var ie=typeof global==`object`&&global&&global.Object===Object&&global,V=typeof self==`object`&&self&&self.Object===Object&&self,H=ie||V||Function(`return this`)(),ae=typeof e==`object`&&e&&!e.nodeType&&e,oe=ae&&typeof t==`object`&&t&&!t.nodeType&&t,se=oe&&oe.exports===ae&&ie.process,ce=function(){try{return se&&se.binding(`util`)}catch{}}(),le=ce&&ce.isTypedArray;function ue(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n-1}function ot(e,t){var n=this.__data__,r=St(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}tt.prototype.clear=nt,tt.prototype.delete=rt,tt.prototype.get=it,tt.prototype.has=at,tt.prototype.set=ot;function st(e){var t=-1,n=e?e.length:0;for(this.clear();++tt||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Gt(e,t){return function(n,r){if(n==null)return n;if(!_n(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++al))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var f=-1,p=!0,m=i&a?new pt:void 0;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=c}function xn(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function Sn(e){return!!e&&typeof e==`object`}function Cn(e){return typeof e==`symbol`||Sn(e)&&Oe.call(e)==C}var wn=le?he(le):Nt;function Tn(e){return e==null?``:Vt(e)}function En(e,t,n){var r=e==null?void 0:Et(e,t);return r===void 0?n:r}function Dn(e,t){return e!=null&&en(e,t,Ot)}function On(e){return _n(e)?xt(e):Ft(e)}function kn(e){return e}function An(e){return nn(e)?fe(un(e)):Bt(e)}t.exports=fn}))(),1),Dv={InputWrapper:`_InputWrapper_1lqd1_1`,Shortcut:`_Shortcut_1lqd1_9`,Input:`_Input_1lqd1_1`,SelectedValue:`_SelectedValue_1lqd1_52`,SelectedName:`_SelectedName_1lqd1_67`,ItemType:`_ItemType_1lqd1_79`,Popover:`_Popover_1lqd1_83`,List:`_List_1lqd1_95`,Group:`_Group_1lqd1_99`,GroupLabel:`_GroupLabel_1lqd1_107`,Item:`_Item_1lqd1_79`,ItemHeader:`_ItemHeader_1lqd1_147`,ItemName:`_ItemName_1lqd1_153`,ItemTypes:`_ItemTypes_1lqd1_159`,ItemMissionName:`_ItemMissionName_1lqd1_178`,NoResults:`_NoResults_1lqd1_183`,Backdrop:`_Backdrop_1lqd1_190`},Ov=new Set([`SkiFree`,`SkiFree_Daily`,`SkiFree_Randomizer`]),kv={"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)`},Av={"z_mappacks/DM":`DM`,"z_mappacks/LCTF":`LCTF`,"z_mappacks/Lak":`LakRabbit`},jv=e=>{let t=e.match(/^(.*)(\/[^/]+)$/);return t?t[1]:``},Mv=T().filter(e=>!Ov.has(e)).map(e=>{let t=w(e),[n]=E(t.resourcePath),r=jv(n),i=kv[n]??Av[r]??null;return{resourcePath:t.resourcePath,missionName:e,displayName:t.displayName,sourcePath:n,groupName:i,missionTypes:t.missionTypes}}),Nv=new Map(Mv.map(e=>[e.missionName,e]));function Pv(e){let t=new Map;for(let n of e){let e=t.get(n.groupName)??[];e.push(n),t.set(n.groupName,e)}return t.forEach((e,n)=>{t.set(n,(0,Ev.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],[`asc`]))}),(0,Ev.default)(Array.from(t.entries()),[([e])=>e===`Official`?0:e==null?2:1,([e])=>e?e.toLowerCase():``],[`asc`,`asc`])}var Fv=Pv(Mv),Iv=typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function Lv(e){let t=(0,H.c)(12),{mission:n}=e,r=n.displayName||n.missionName,i;t[0]===r?i=t[1]:(i=(0,U.jsx)(`span`,{className:Dv.ItemName,children:r}),t[0]=r,t[1]=i);let a;t[2]===n.missionTypes?a=t[3]:(a=n.missionTypes.length>0&&(0,U.jsx)(`span`,{className:Dv.ItemTypes,children:n.missionTypes.map(Rv)}),t[2]=n.missionTypes,t[3]=a);let o;t[4]!==i||t[5]!==a?(o=(0,U.jsxs)(`span`,{className:Dv.ItemHeader,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===n.missionName?s=t[8]:(s=(0,U.jsx)(`span`,{className:Dv.ItemMissionName,children:n.missionName}),t[7]=n.missionName,t[8]=s);let c;return t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(U.Fragment,{children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Rv(e){return(0,U.jsx)(`span`,{className:Dv.ItemType,"data-mission-type":e,children:e},e)}function zv(e){let t=(0,H.c)(48),{value:n,missionType:r,onChange:i,disabled:a,autoFocus:o}=e,[s,c]=(0,V.useState)(``),l=(0,V.useRef)(null),u=(0,V.useRef)(r),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{(0,V.startTransition)(()=>c(e))},t[0]=d):d=t[0];let f=cv({resetValueOnHide:!0,selectedValue:n,setSelectedValue:e=>{if(e){let t=u.current,n=w(e).missionTypes;(!t||!n.includes(t))&&(t=n[0]),i({missionName:e,missionType:t}),l.current?.blur()}},setValue:d}),p=Mf(f,`open`),m,h;t[1]===f?(m=t[2],h=t[3]):(m=()=>{let e=e=>{e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l.current?.focus(),f.show())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},h=[f],t[1]=f,t[2]=m,t[3]=h),(0,V.useEffect)(m,h);let g;t[4]===n?g=t[5]:(g=Nv.get(n),t[4]=n,t[5]=g);let _=g,v;bb0:{if(!s){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e={type:`grouped`,groups:Fv},t[6]=e):e=t[6],v=e;break bb0}let e;t[7]===s?e=t[8]:(e=pv(Mv,s,{keys:[`displayName`,`missionName`,`missionTypes`,`groupName`]}),t[7]=s,t[8]=e);let n=e,r;t[9]===n?r=t[10]:(r={type:`flat`,missions:n},t[9]=n,t[10]=r),v=r}let y=v,b=_?_.displayName||_.missionName:n,x=y.type===`flat`?y.missions.length===0:y.groups.length===0,S=e=>(0,U.jsx)(J_,{value:e.missionName,className:Dv.Item,focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(u.current=r,e.missionName===n&&i({missionName:e.missionName,missionType:r})):u.current=null}else u.current=null},children:(0,U.jsx)(Lv,{mission:e})},e.missionName),C=lv,T=p?`visible`:`hidden`,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,U.jsx)(`div`,{className:Dv.Backdrop}),t[11]=E):E=t[11];let D;t[12]===T?D=t[13]:(D=(0,U.jsx)(V.Activity,{mode:T,children:E}),t[12]=T,t[13]=D);let O=_?void 0:`Choose a map…`,k,A;t[14]===f?(k=t[15],A=t[16]):(k=()=>{try{document.exitPointerLock()}catch{}f.show()},A=e=>{e.key===`Escape`&&!f.getState().open&&l.current?.blur()},t[14]=f,t[15]=k,t[16]=A);let j;t[17]!==o||t[18]!==a||t[19]!==k||t[20]!==A||t[21]!==O?(j=(0,U.jsx)(L_,{ref:l,autoSelect:!0,autoFocus:o,disabled:a,placeholder:O,className:Dv.Input,onFocus:k,onKeyDown:A}),t[17]=o,t[18]=a,t[19]=k,t[20]=A,t[21]=O,t[22]=j):j=t[22];let M;t[23]!==b||t[24]!==r||t[25]!==_?(M=_&&(0,U.jsxs)(`div`,{className:Dv.SelectedValue,children:[(0,U.jsx)(`span`,{className:Dv.SelectedName,children:b}),r&&(0,U.jsx)(`span`,{className:Dv.ItemType,"data-mission-type":r,children:r})]}),t[23]=b,t[24]=r,t[25]=_,t[26]=M):M=t[26];let ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,U.jsx)(`kbd`,{className:Dv.Shortcut,children:Iv?`⌘K`:`^K`}),t[27]=ee):ee=t[27];let N;t[28]!==j||t[29]!==M?(N=(0,U.jsxs)(`div`,{className:Dv.InputWrapper,children:[j,M,ee]}),t[28]=j,t[29]=M,t[30]=N):N=t[30];let P=tv,F=Dv,te=Z_,I=Dv,ne=y.type===`flat`?y.missions.map(S):y.groups.map(e=>{let[t,n]=e;return t?(0,U.jsxs)(B_,{className:Dv.Group,children:[(0,U.jsx)(U_,{className:Dv.GroupLabel,children:t}),n.map(S)]},t):(0,U.jsx)(V.Fragment,{children:n.map(S)},`ungrouped`)}),L;t[31]===x?L=t[32]:(L=x&&(0,U.jsx)(`div`,{className:Dv.NoResults,children:`No missions found`}),t[31]=x,t[32]=L);let R;t[33]!==te||t[34]!==I.List||t[35]!==ne||t[36]!==L?(R=(0,U.jsxs)(te,{className:I.List,children:[ne,L]}),t[33]=te,t[34]=I.List,t[35]=ne,t[36]=L,t[37]=R):R=t[37];let re;t[38]!==P||t[39]!==F.Popover||t[40]!==R?(re=(0,U.jsx)(P,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:F.Popover,children:R}),t[38]=P,t[39]=F.Popover,t[40]=R,t[41]=re):re=t[41];let z;return t[42]!==C||t[43]!==f||t[44]!==N||t[45]!==re||t[46]!==D?(z=(0,U.jsxs)(C,{store:f,children:[D,N,re]}),t[42]=C,t[43]=f,t[44]=N,t[45]=re,t[46]=D,t[47]=z):z=t[47],z}function Bv(e){return S({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`m12 6-6 8h12zM6 16h12v2H6z`},child:[]}]})(e)}var Vv={Header:`_Header_vfnqh_1`,MissionInfo:`_MissionInfo_vfnqh_7`,MissionName:`_MissionName_vfnqh_19 _SelectedName_1lqd1_67`,MissionType:`_MissionType_vfnqh_23 _ItemType_1lqd1_79`,MissionTypeDisplayName:`_MissionTypeDisplayName_vfnqh_28`,Metadata:`_Metadata_vfnqh_33`,Attribution:`_Attribution_vfnqh_44`,ServerInfo:`_ServerInfo_vfnqh_45`,PlayerName:`_PlayerName_vfnqh_49`,RecordingDate:`_RecordingDate_vfnqh_50`,ServerName:`_ServerName_vfnqh_51`,ActionButton:`_ActionButton_vfnqh_55 _IconButton_1ypaz_23`,EjectIcon:`_EjectIcon_vfnqh_72`,Error:`_Error_vfnqh_77`};function Hv(){let e=(0,H.c)(24),t=hs(),n=Cs(),r=ys(),i=xs(),a=Ts(),o=Ds(),s=ks(),[c,l]=s?s.split(` `):[null,null],u=t===`live`,d=Ls(),f=Ps(Gv),p=Wv,m=Uv,h=Vv,g;e[0]!==n||e[1]!==r||e[2]!==i?(g=n&&r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:Vv.MissionName,children:n}),r&&(0,U.jsxs)(U.Fragment,{children:[` `,(0,U.jsx)(`span`,{className:Vv.MissionType,"data-mission-type":r,children:i===`LCTF`?`LCTF`:r})]})]}):null,e[0]=n,e[1]=r,e[2]=i,e[3]=g):g=e[3];let _;e[4]===g?_=e[5]:(_=(0,U.jsx)(`div`,{className:Vv.MissionInfo,children:g}),e[4]=g,e[5]=_);let v=Vv,y=u?f?o?(0,U.jsxs)(`div`,{className:Vv.Attribution,children:[`Connected as`,` `,(0,U.jsx)(`span`,{className:Vv.PlayerName,children:o})]}):null:(0,U.jsx)(`div`,{className:Vv.Error,children:`Disconnected`}):o&&s?(0,U.jsxs)(`div`,{className:Vv.Attribution,children:[`Recorded by `,(0,U.jsx)(`span`,{className:Vv.PlayerName,children:o}),` `,`on`,` `,(0,U.jsx)(`span`,{className:Vv.RecordingDate,children:c.replace(/-/g,` `)}),` `,`at `,(0,U.jsx)(`span`,{className:Vv.RecordingDate,children:l})]}):null,b;e[6]===a?b=e[7]:(b=a?(0,U.jsxs)(`div`,{className:Vv.ServerInfo,children:[`Server: `,(0,U.jsx)(`span`,{className:Vv.ServerName,children:a})]}):null,e[6]=a,e[7]=b);let x;e[8]!==v.Metadata||e[9]!==y||e[10]!==b?(x=(0,U.jsxs)(`div`,{className:v.Metadata,children:[y,b]}),e[8]=v.Metadata,e[9]=y,e[10]=b,e[11]=x):x=e[11];let S;e[12]!==t||e[13]!==m||e[14]!==p||e[15]!==u||e[16]!==f||e[17]!==d?(S=t===`demo`?(0,U.jsx)(`button`,{type:`button`,className:Vv.ActionButton,title:`Unload demo`,"aria-label":`Unload demo`,onClick:p,disabled:!d,children:(0,U.jsx)(Bv,{className:Vv.EjectIcon})}):u?(0,U.jsx)(`button`,{type:`button`,className:Vv.ActionButton,title:`Disconnect`,"aria-label":`Disconnect`,onClick:m,disabled:!f,children:(0,U.jsx)(At,{})}):null,e[12]=t,e[13]=m,e[14]=p,e[15]=u,e[16]=f,e[17]=d,e[18]=S):S=e[18];let C;return e[19]!==h.Header||e[20]!==_||e[21]!==x||e[22]!==S?(C=(0,U.jsxs)(`div`,{className:h.Header,children:[_,x,S]}),e[19]=h.Header,e[20]=_,e[21]=x,e[22]=S,e[23]=C):C=e[23],C}function Uv(){Ns.getState().disconnectServer(),te.getState().setRecording(null)}function Wv(){te.getState().setRecording(null)}function Gv(e){return e.gameStatus===`connected`||e.gameStatus===`authenticating`}function Kv(e){let t=(0,H.c)(5),{onChangeMission:n}=e,{setRecording:r}=qs(),i=(0,V.useEffectEvent)(n),a;t[0]!==i||t[1]!==r?(a=()=>(window.setMissionName=e=>{let t=w(e).missionTypes;i({missionName:e,missionType:t[0]})},window.getMissionList=T,window.getMissionInfo=w,window.loadDemoRecording=r,qv),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=[r],t[3]=r,t[4]=o),(0,V.useEffect)(a,o)}function qv(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo,delete window.loadDemoRecording}var Jv=Object.defineProperty,Yv=(e,t,n)=>t in e?Jv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xv=(e,t,n)=>(Yv(e,typeof t==`symbol`?t:t+``,n),n),Zv=class{constructor(){Xv(this,`_listeners`)}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let t=this._listeners[e.type];if(t!==void 0){e.target=this;let n=t.slice(0);for(let t=0,r=n.length;tt in e?Qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ey=(e,t,n)=>($v(e,typeof t==`symbol`?t:t+``,n),n),ty=new M(0,0,0,`YXZ`),ny=new j,ry={type:`change`},iy={type:`lock`},ay={type:`unlock`},oy=.002,sy=Math.PI/2,cy=class extends Zv{constructor(e,t){super(),ey(this,`camera`),ey(this,`domElement`),ey(this,`isLocked`),ey(this,`minPolarAngle`),ey(this,`maxPolarAngle`),ey(this,`pointerSpeed`),ey(this,`onMouseMove`,e=>{!this.domElement||this.isLocked===!1||(ty.setFromQuaternion(this.camera.quaternion),ty.y-=e.movementX*oy*this.pointerSpeed,ty.x-=e.movementY*oy*this.pointerSpeed,ty.x=Math.max(sy-this.maxPolarAngle,Math.min(sy-this.minPolarAngle,ty.x)),this.camera.quaternion.setFromEuler(ty),this.dispatchEvent(ry))}),ey(this,`onPointerlockChange`,()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(iy),this.isLocked=!0):(this.dispatchEvent(ay),this.isLocked=!1))}),ey(this,`onPointerlockError`,()=>{console.error(`THREE.PointerLockControls: Unable to use Pointer Lock API`)}),ey(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))}),ey(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))}),ey(this,`dispose`,()=>{this.disconnect()}),ey(this,`getObject`,()=>this.camera),ey(this,`direction`,new j(0,0,-1)),ey(this,`getDirection`,e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),ey(this,`moveForward`,e=>{ny.setFromMatrixColumn(this.camera.matrix,0),ny.crossVectors(this.camera.up,ny),this.camera.position.addScaledVector(ny,e)}),ey(this,`moveRight`,e=>{ny.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(ny,e)}),ey(this,`lock`,()=>{this.domElement&&this.domElement.requestPointerLock()}),ey(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)}},ly=(0,V.createContext)(null);function uy(){let e=(0,V.useContext)(ly);if(!e)throw Error(`No JoystickContext found. Did you forget to add a ?`);return e}function dy(e){let t=(0,H.c)(7),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={angle:0,force:0},t[0]=r):r=t[0];let i=(0,V.useRef)(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a={angle:0,force:0},t[1]=a):a=t[1];let o=(0,V.useRef)(a),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{let{angle:t,force:n}=e;t!=null&&(i.current.angle=t),n!=null&&(i.current.force=n)},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{let{angle:t,force:n}=e;t!=null&&(o.current.angle=t),n!=null&&(o.current.force=n)},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={moveState:i,lookState:o,setMoveState:c,setLookState:u},t[4]=d):d=t[4];let f=d,p;return t[5]===n?p=t[6]:(p=(0,U.jsx)(ly,{value:f,children:n}),t[5]=n,t[6]=p),p}var fy=(0,V.createContext)(null);function py(){let e=(0,V.useContext)(fy);if(!e)throw Error(`useCameras must be used within CamerasProvider`);return e}function my({children:e}){let t=o(e=>e.camera),[n,r]=(0,V.useState)(-1),[i,a]=(0,V.useState)({}),[s,c]=(0,V.useState)(()=>({initialized:!1,position:null,quarternion:null})),l=(0,V.useCallback)(e=>{a(t=>({...t,[e.id]:e}))},[]),u=(0,V.useCallback)(e=>{a(t=>{let{[e.id]:n,...r}=t;return r})},[]),d=Object.keys(i).length,f=(0,V.useCallback)(e=>{if(e>=0&&e{f(d?(n+1)%d:-1)},[d,n,f]);(0,V.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith(`#c`)){let[t,n]=e.slice(2).split(`~`),r=t.split(`,`).map(e=>parseFloat(e)),i=n.split(`,`).map(e=>parseFloat(e));c({initialized:!0,position:new j(...r),quarternion:new N(...i)})}else c({initialized:!0,position:null,quarternion:null})};return window.addEventListener(`hashchange`,e),e(),()=>{window.removeEventListener(`hashchange`,e)}},[]),(0,V.useEffect)(()=>{s.initialized&&s.position&&(t.position.copy(s.position),s.quarternion&&t.quaternion.copy(s.quarternion))},[t,s]),(0,V.useEffect)(()=>{!s.initialized||s.position||d>0&&n===-1&&f(0)},[d,f,n,s]);let m=(0,V.useMemo)(()=>({registerCamera:l,unregisterCamera:u,nextCamera:p,setCameraIndex:f,cameraCount:d}),[l,u,p,f,d]);return d===0&&n!==-1&&r(-1),(0,U.jsx)(fy.Provider,{value:m,children:e})}var hy=(0,V.createContext)(null);function gy(){let e=(0,V.useContext)(hy);if(!e)throw Error(`useInputContext must be used within an InputProvider`);return e}function _y(){return gy().onInput}var vy=function(e){return e.forward=`forward`,e.backward=`backward`,e.left=`left`,e.right=`right`,e.up=`up`,e.down=`down`,e.lookUp=`lookUp`,e.lookDown=`lookDown`,e.lookLeft=`lookLeft`,e.lookRight=`lookRight`,e.camera1=`camera1`,e.camera2=`camera2`,e.camera3=`camera3`,e.camera4=`camera4`,e.camera5=`camera5`,e.camera6=`camera6`,e.camera7=`camera7`,e.camera8=`camera8`,e.camera9=`camera9`,e}({}),yy=[{name:vy.forward,keys:[`KeyW`]},{name:vy.backward,keys:[`KeyS`]},{name:vy.left,keys:[`KeyA`]},{name:vy.right,keys:[`KeyD`]},{name:vy.up,keys:[`Space`]},{name:vy.down,keys:[`ShiftLeft`,`ShiftRight`]},{name:vy.lookUp,keys:[`ArrowUp`]},{name:vy.lookDown,keys:[`ArrowDown`]},{name:vy.lookLeft,keys:[`ArrowLeft`]},{name:vy.lookRight,keys:[`ArrowRight`]},{name:vy.camera1,keys:[`Digit1`]},{name:vy.camera2,keys:[`Digit2`]},{name:vy.camera3,keys:[`Digit3`]},{name:vy.camera4,keys:[`Digit4`]},{name:vy.camera5,keys:[`Digit5`]},{name:vy.camera6,keys:[`Digit6`]},{name:vy.camera7,keys:[`Digit7`]},{name:vy.camera8,keys:[`Digit8`]},{name:vy.camera9,keys:[`Digit9`]}],by=2,xy=11,Sy=3,Cy=.002;function wy(e){let t=(e-b)/(1-b);return(Math.round(t*15)+1)/16}function Ty(){let e=(0,H.c)(50),t=g(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],e[0]=n):n=e[0],(0,V.useEffect)(Oy,n);let{speedMultiplier:r,setSpeedMultiplier:i,mouseSensitivity:s,invertScroll:c,invertDrag:l}=v(),{onInput:u,mode:d}=gy(),[f,p]=ne(),m=o(Dy),h=o(Ey),{nextCamera:_,setCameraIndex:y,cameraCount:x}=py(),S=(0,V.useRef)(null),C;e[1]===c?C=e[2]:(C=()=>c,e[1]=c,e[2]=C);let w=(0,V.useEffectEvent)(C),T;e[3]===l?T=e[4]:(T=()=>l,e[3]=l,e[4]=T);let E=(0,V.useEffectEvent)(T),D;e[5]===d?D=e[6]:(D=()=>d,e[5]=d,e[6]=D);let O=(0,V.useEffectEvent)(D),k;e[7]===s?k=e[8]:(k=()=>s,e[7]=s,e[8]=k);let A=(0,V.useEffectEvent)(k),j;e[9]===t?j=e[10]:(j=()=>t,e[9]=t,e[10]=j);let M=(0,V.useEffectEvent)(j),ee=(0,V.useRef)(0),N=(0,V.useRef)(0),P=(0,V.useRef)(!1),F=(0,V.useRef)(!1),te,I;e[11]!==m||e[12]!==h.domElement?(te=()=>{let e=new cy(m,h.domElement);return S.current=e,()=>{e.dispose()}},I=[m,h.domElement],e[11]=m,e[12]=h.domElement,e[13]=te,e[14]=I):(te=e[13],I=e[14]),(0,V.useEffect)(te,I);let L,R;e[15]===t?(L=e[16],R=e[17]):(L=()=>{t&&S.current?.isLocked&&S.current.unlock()},R=[t],e[15]=t,e[16]=L,e[17]=R),(0,V.useEffect)(L,R);let re;e[18]!==E||e[19]!==M||e[20]!==O||e[21]!==A||e[22]!==h.domElement||e[23]!==d||e[24]!==_?(re=()=>{let e=h.domElement,t=!1,n=!1,r=0,i=0,a=a=>{S.current?.isLocked||a.target===e&&(t=!0,n=!1,r=a.clientX,i=a.clientY)},o=e=>{if(S.current?.isLocked){let t=A();ee.current+=e.movementX*t,N.current+=e.movementY*t;return}if(!t||!n&&Math.abs(e.clientX-r){t=!1},c=t=>{let r=S.current;r?.isLocked?d===`follow`?P.current=!0:d===`local`&&_():t.target===e&&!n&&!M()&&r?.lock()};return e.addEventListener(`mousedown`,a),document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s),document.addEventListener(`click`,c),()=>{e.removeEventListener(`mousedown`,a),document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s),document.removeEventListener(`click`,c)}},e[18]=E,e[19]=M,e[20]=O,e[21]=A,e[22]=h.domElement,e[23]=d,e[24]=_,e[25]=re):re=e[25];let z;e[26]!==m||e[27]!==h.domElement||e[28]!==d||e[29]!==_?(z=[m,h.domElement,_,d],e[26]=m,e[27]=h.domElement,e[28]=d,e[29]=_,e[30]=z):z=e[30],(0,V.useEffect)(re,z);let B,ie;e[31]!==x||e[32]!==y||e[33]!==f?(B=()=>{let e=[vy.camera1,vy.camera2,vy.camera3,vy.camera4,vy.camera5,vy.camera6,vy.camera7,vy.camera8,vy.camera9];return f(t=>{for(let n=0;n{let e=e=>{e.preventDefault();let t=w()?-1:1,n=(e.deltaY>0?-1:1)*t,r=Math.ceil(Math.log2(Math.abs(e.deltaY)+1)),a=Math.max(by,Math.min(xy,r))*n;i(e=>{let t=Math.round(e*100)+a;return Math.max(b,Math.min(1,t/100))})},t=h.domElement;return t.addEventListener(`wheel`,e,{passive:!1}),()=>{t.removeEventListener(`wheel`,e)}},e[36]=w,e[37]=h.domElement,e[38]=i,e[39]=ae):ae=e[39];let oe;e[40]!==h.domElement||e[41]!==i?(oe=[h.domElement,i],e[40]=h.domElement,e[41]=i,e[42]=oe):oe=e[42],(0,V.useEffect)(ae,oe);let se,ce;e[43]===d?(se=e[44],ce=e[45]):(se=()=>{if(d===`local`)return;let e=e=>{if(e.code!==`KeyO`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable||(F.current=!0)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},ce=[d],e[43]=d,e[44]=se,e[45]=ce),(0,V.useEffect)(se,ce);let le;return e[46]!==p||e[47]!==u||e[48]!==r?(le=(e,t)=>{let{forward:n,backward:i,left:a,right:o,up:s,down:c,lookUp:l,lookDown:d,lookLeft:f,lookRight:m}=p(),h=ee.current,g=N.current;ee.current=0,N.current=0,f&&(h-=1*t),m&&(h+=1*t),l&&(g-=1*t),d&&(g+=1*t);let _=0,v=0,y=0;a&&(_=-1),o&&(_+=1),n&&(v=1),i&&--v,s&&(y=1),c&&--y;let b=wy(r);_=Math.max(-1,Math.min(1,_*b)),v=Math.max(-1,Math.min(1,v*b)),y=Math.max(-1,Math.min(1,y*b));let x=[!1,!1,!1,!1,!1,!1];P.current&&=(x[0]=!0,!1),F.current&&=(x[2]=!0,!1);let S=h!==0||g!==0,C=_!==0||v!==0||y!==0,w=x.some(Boolean);!S&&!C&&!w||u({deltaYaw:h,deltaPitch:g,x:_,y:v,z:y,triggers:x,delta:t})},e[46]=p,e[47]=u,e[48]=r,e[49]=le):le=e[49],a(le),null}function Ey(e){return e.gl}function Dy(e){return e.camera}function Oy(){let e=ky;return window.addEventListener(`keydown`,e,{capture:!0}),window.addEventListener(`keyup`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),window.removeEventListener(`keyup`,e,{capture:!0})}}function ky(e){(e.metaKey||e.ctrlKey)&&e.key===`k`||e.metaKey&&e.stopImmediatePropagation()}var Ay=(0,V.lazy)(()=>I(()=>import(`./TouchHandler-DC30RPUy.js`).then(e=>({default:e.TouchHandler})),__vite__mapDeps([3,2,4,5,6,7,8,9])));function jy(e){let t=(0,H.c)(9),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let i=(0,V.useRef)(r),[a,o]=(0,V.useState)(`local`),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i.current.push(e)},t[1]=s):s=t[1];let c=s,l;t[2]===a?l=t[3]:(l={moveQueue:i,onInput:c,mode:a,setMode:o},t[2]=a,t[3]=l);let u;t[4]===n?u=t[5]:(u=(0,U.jsx)(L,{map:yy,children:(0,U.jsx)(dy,{children:n})}),t[4]=n,t[5]=u);let d;return t[6]!==l||t[7]!==u?(d=(0,U.jsx)(hy.Provider,{value:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8],d}function My(){let e=(0,H.c)(5),t=g(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsx)(Ty,{}),e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=t?(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Ay,{})}):null,e[1]=t,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,U.jsxs)(U.Fragment,{children:[n,r]}),e[3]=r,e[4]=i),i}var Ny=(0,V.lazy)(()=>I(()=>import(`./TouchJoystick-Bqhkb-oZ.js`).then(e=>({default:e.TouchJoystick})),__vite__mapDeps([10,2,11,8,5,9,12]))),Py=(0,V.lazy)(()=>I(()=>import(`./KeyboardOverlay-97AmC_to.js`).then(e=>({default:e.KeyboardOverlay})),__vite__mapDeps([13,14,2,1,15,5,7,16,17])));function Fy(){let e=(0,H.c)(7),t=g(),n;e[0]===t?n=e[1]:(n=t?(0,U.jsx)(Ny,{}):null,e[0]=t,e[1]=n);let r;e[2]===t?r=e[3]:(r=t===!1?(0,U.jsx)(Py,{}):null,e[2]=t,e[3]=r);let i;return e[4]!==n||e[5]!==r?(i=(0,U.jsxs)(V.Suspense,{children:[n,r]}),e[4]=n,e[5]=r,e[6]=i):i=e[6],i}var Iy={LoadingIndicator:`_LoadingIndicator_1gfum_1`,loadingComplete:`_loadingComplete_1gfum_1`,Spinner:`_Spinner_1gfum_19`,spin:`_spin_1gfum_1`,Progress:`_Progress_1gfum_28`,ProgressBar:`_ProgressBar_1gfum_36`,ProgressText:`_ProgressText_1gfum_43`};function Ly(e){let t=(0,H.c)(11),{isLoading:n,progress:r}=e,i=!n,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(`div`,{className:Iy.Spinner}),t[0]=a):a=t[0];let o=`${r*100}%`,s;t[1]===o?s=t[2]:(s=(0,U.jsx)(`div`,{className:Iy.Progress,children:(0,U.jsx)(`div`,{className:Iy.ProgressBar,style:{width:o}})}),t[1]=o,t[2]=s);let c;t[3]===r?c=t[4]:(c=Math.round(r*100),t[3]=r,t[4]=c);let l;t[5]===c?l=t[6]:(l=(0,U.jsxs)(`div`,{className:Iy.ProgressText,children:[c,`%`]}),t[5]=c,t[6]=l);let u;return t[7]!==i||t[8]!==s||t[9]!==l?(u=(0,U.jsxs)(`div`,{className:Iy.LoadingIndicator,"data-complete":i,children:[a,s,l]}),t[7]=i,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}var Ry={Frame:`_Frame_17p6o_1`,Toolbar:`_Toolbar_17p6o_16`,CancelButton:`_CancelButton_17p6o_29`,Sidebar:`_Sidebar_17p6o_46`,Content:`_Content_17p6o_60`,ThreeView:`_ThreeView_17p6o_69`,PlayerBar:`_PlayerBar_17p6o_78`,ToggleSidebarButton:`_ToggleSidebarButton_17p6o_88`,Backdrop:`_Backdrop_17p6o_120`};function zy({children:e}){return e}function By(e,t){return(0,V.lazy)(()=>t().then(t=>({default:t[e]})))}var Vy=By(`GameView`,()=>I(()=>import(`./GameView-xy7ylEXW.js`),__vite__mapDeps([18,2,11,14,1,19,20,21,4,5,6,7,22,8,9,16,23,24,25,26,27,28,29,30,31,32,33,34]))),Hy=By(`DemoPlaybackControls`,()=>I(()=>import(`./DemoPlaybackControls-D6juVz-E.js`),__vite__mapDeps([35,2,5,7,16,36]))),Uy=By(`PlayerHUD`,()=>I(()=>import(`./PlayerHUD-BjRUZfwy.js`),__vite__mapDeps([37,2,11,14,1,5,7,16,27,9,38]))),Wy=By(`MapInfoDialog`,()=>I(()=>import(`./MapInfoDialog-DeFCm6DR.js`),__vite__mapDeps([39,2,14,1,28,22,5,27,9,40]))),Gy=By(`ServerBrowser`,()=>I(()=>import(`./ServerBrowser-Ng0eCpkZ.js`),__vite__mapDeps([41,2,14,1,8,5,9,7,42]))),Ky=By(`ScoreScreen`,()=>I(()=>import(`./ScoreScreen-CUK2P6bG.js`),__vite__mapDeps([43,2,14,1,44,5,7,16,45])));function qy(){let[e,t]=y(),n=vt(),{clearFogEnabledOverride:r,sidebarOpen:i,setSidebarOpen:a}=c(),{missionName:o,missionType:s}=e,[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(!1),[h,_]=(0,V.useState)(!1),[v,b]=(0,V.useState)(0),[x,S]=(0,V.useState)(!0),C=g(),T=(0,V.useCallback)(e=>{window.location.hash=``,r(),_(!1),Ns.getState().disconnectServer(),te.getState().setRecording(null),ss.getState().endStreaming(),t(e),C&&a(!1)},[r,t,C,a]);Kv({onChangeMission:T});let E=Ls(),D=hs(),O=D===`demo`||D===`live`,k=_s(),A=ys();(0,V.useEffect)(()=>{if(!(!O||!k))try{let e=w(k);t({missionName:k,missionType:A&&e.missionTypes.includes(A)?A:void 0})}catch{t(null)}},[O,k,A,t]),(0,V.useEffect)(()=>{E&&_(!1)},[E]);let j=Ps(e=>e.gameStatus);(0,V.useEffect)(()=>{j===`connected`&&C&&a(!1)},[j,C,a]),(0,V.useEffect)(()=>{E&&C&&a(!1)},[C,E,a]);let M=v,ee=M<1;(0,V.useEffect)(()=>{if(ee)S(!0);else{let e=setTimeout(()=>S(!1),500);return()=>clearTimeout(e)}},[ee]);let N=(0,V.useCallback)((e,t=0)=>{b(t)},[]),P=(0,V.useRef)(null),F=(0,V.useRef)(null),I=(0,V.useCallback)(()=>u(!0),[]),ne=(0,V.useCallback)(()=>{O&&m(!0)},[O]),L=(0,V.useCallback)(()=>{n.live&&f(!0)},[n.live]),R=(0,V.useCallback)(()=>{O&&_(!0)},[O]),re=(0,V.useCallback)(()=>{_(!1)},[]),z=(0,V.useCallback)(e=>{P.current=e.camera,F.current=e.invalidate},[]);return(0,U.jsx)(`main`,{className:Ry.Frame,children:(0,U.jsxs)(Is,{children:[(0,U.jsxs)(`header`,{className:Ry.Toolbar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`button`,{type:`button`,className:Ry.ToggleSidebarButton,"data-orientation":`top`,"aria-label":i?`Close sidebar`:`Open sidebar`,title:i?`Close sidebar`:`Open sidebar`,onClick:e=>{(0,V.startTransition)(()=>a(e=>!e))},children:i?(0,U.jsx)(Et,{}):(0,U.jsx)(Tt,{})}),(0,U.jsx)(`button`,{type:`button`,className:Ry.ToggleSidebarButton,"data-orientation":`left`,"aria-label":i?`Close sidebar`:`Open sidebar`,title:i?`Close sidebar`:`Open sidebar`,onClick:e=>{(0,V.startTransition)(()=>a(e=>!e))},children:i?(0,U.jsx)(Ot,{}):(0,U.jsx)(Dt,{})}),(0,U.jsx)(V.Activity,{mode:O&&!h?`visible`:`hidden`,children:(0,U.jsx)(Hv,{})}),(0,U.jsxs)(V.Activity,{mode:!O||h?`visible`:`hidden`,children:[(0,U.jsx)(zv,{value:h?``:o,missionType:h?``:s,onChange:T,autoFocus:h}),h&&(0,U.jsx)(`button`,{type:`button`,className:Ry.CancelButton,onClick:()=>{_(!1)},children:`Cancel`})]})]}),i?(0,U.jsx)(`div`,{className:Ry.Backdrop}):null,(0,U.jsx)(V.Activity,{mode:i?`visible`:`hidden`,children:(0,U.jsx)(zy,{children:(0,U.jsx)(`div`,{className:Ry.Sidebar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-open":i,children:(0,U.jsx)(Il,{missionName:o,missionType:s,choosingMap:h,cameraRef:P,invalidateRef:F,onOpenMapInfo:I,onOpenScoreScreen:ne,onOpenServerBrowser:L,onChooseMap:R,onCancelChoosingMap:re})})})}),(0,U.jsx)(jy,{children:(0,U.jsxs)(`div`,{className:Ry.Content,children:[(0,U.jsx)(`div`,{className:Ry.ThreeView,children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Vy,{missionName:o,missionType:s,dpr:l||d||p?.25:void 0,onCreated:z,onLoadingChange:N})})}),O&&!p?(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Uy,{})}):null,(0,U.jsx)(Fy,{}),x&&(0,U.jsx)(Ly,{isLoading:ee,progress:M})]})}),(0,U.jsx)(`footer`,{className:Ry.PlayerBar,onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:E?.source===`demo`?(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Hy,{})}):null}),l?(0,U.jsx)(zy,{children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Wy,{onClose:()=>u(!1),missionName:o,missionType:s??``})})}):null,d?(0,U.jsx)(zy,{children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Gy,{onClose:()=>f(!1)})})}):null,p?(0,U.jsx)(zy,{children:(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(Ky,{onClose:()=>m(!1)})})}):null]})})}var Jy=new pt;function Yy(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(V.Suspense,{children:(0,U.jsx)(pe,{children:(0,U.jsx)(yt,{children:(0,U.jsx)(gt,{client:Jy,children:(0,U.jsx)(h,{children:(0,U.jsx)(qy,{})})})})})}),e[0]=t):t=e[0],t}(0,ie.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(V.StrictMode,{children:(0,U.jsx)(Yy,{})}));export{ve as $,Ro as A,ro as B,es as C,Zo as D,Xo as E,oo as F,Mt as G,Ja as H,xo as I,ht as J,jt as K,ho as L,To as M,$a as N,Jo as O,Co as P,We as Q,io as R,ts as S,Qo as T,qa as U,to as V,za as W,Je as X,nt as Y,Ge as Z,hs as _,py as a,Me as at,is as b,Us as c,ge as ct,Ls as d,xe as et,Gs as f,us as g,ss as h,my as i,Ce as it,eo as j,$o as k,zs as l,me as lt,Ps as m,gy as n,Le as nt,uy as o,He as ot,Ns as p,wt as q,_y as r,we as rt,Vs as s,Se as st,My as t,ye as tt,qs as u,B as ut,ps as v,Yo as w,ns as x,ms as y,ao as z};