t2-mapper/docs/_next/static/chunks/e7345ddf7743e16d.js
2026-02-11 23:52:10 -08:00

528 lines
No EOL
344 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38360,(e,t,r)=>{var n={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",:"A",:"A",:"A",:"A",:"A",Æ:"AE",:"A",:"A",Ȃ:"A",:"A",:"A",:"A",:"A",:"A",Ç:"C",:"C",È:"E",É:"E",Ê:"E",Ë:"E",:"E",:"E",:"E",:"E",:"E",Ȇ:"E",:"E",:"E",:"E",:"E",:"E",:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",:"I",Ȋ:"I",:"I",:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",:"O",:"O",:"O",Ȏ:"O",:"O",:"O",:"O",:"O",:"O",:"O",:"O",:"O",:"O",:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",:"U",:"U",:"U",:"U",:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",:"a",:"a",:"a",:"a",:"a",æ:"ae",:"a",:"a",ȃ:"a",:"a",:"a",:"a",:"a",:"a",ç:"c",:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",:"e",:"e",:"e",:"e",ȇ:"e",:"e",:"e",:"e",:"e",:"e",:"e",ì:"i",í:"i",î:"i",ï:"i",:"i",ȋ:"i",:"i",:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",:"o",:"o",:"o",ȏ:"o",:"o",:"o",:"o",:"o",:"o",:"o",:"o",:"o",:"o",:"o",ù:"u",ú:"u",û:"u",ü:"u",:"u",:"u",:"u",:"u",:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",:"H",:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",:"K",:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",:"W",:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",:"U",:"u",:"U",:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",:"P",:"p",:"S",:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",:"O",:"o",:"O",:"o",:"U",:"u",:"W",:"w",:"Y",:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",:"S",:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",:"D",:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",:"H",:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},i=Object.keys(n).join("|"),a=RegExp(i,"g"),o=RegExp(i,"");function s(e){return n[e]}var l=function(e){return e.replace(a,s)};t.exports=l,t.exports.has=function(e){return!!e.match(o)},t.exports.remove=l},29402,(e,t,r)=>{var n,i,a,o,s="__lodash_hash_undefined__",l=1/0,u="[object Arguments]",c="[object Array]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",p="[object Map]",A="[object Number]",g="[object Object]",v="[object Promise]",C="[object RegExp]",B="[object Set]",y="[object String]",b="[object Symbol]",x="[object WeakMap]",E="[object ArrayBuffer]",S="[object DataView]",F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/,T=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,D=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,G={};G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G[u]=G[c]=G[E]=G[d]=G[S]=G[f]=G[h]=G[m]=G[p]=G[A]=G[g]=G[C]=G[B]=G[y]=G[x]=!1;var L=e.g&&e.g.Object===Object&&e.g,O="object"==typeof self&&self&&self.Object===Object&&self,_=L||O||Function("return this")(),P=r&&!r.nodeType&&r,H=P&&t&&!t.nodeType&&t,k=H&&H.exports===P&&L.process,U=function(){try{return k&&k.binding("util")}catch(e){}}(),j=U&&U.isTypedArray;function N(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function J(e){return function(t){return e(t)}}function K(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Q(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function V(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var q=Array.prototype,X=Function.prototype,W=Object.prototype,Y=_["__core-js_shared__"],z=(i=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",Z=X.toString,$=W.hasOwnProperty,ee=W.toString,et=RegExp("^"+Z.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),er=_.Symbol,en=_.Uint8Array,ei=W.propertyIsEnumerable,ea=q.splice,eo=(a=Object.keys,o=Object,function(e){return a(o(e))}),es=eO(_,"DataView"),el=eO(_,"Map"),eu=eO(_,"Promise"),ec=eO(_,"Set"),ed=eO(_,"WeakMap"),ef=eO(Object,"create"),eh=eN(es),em=eN(el),ep=eN(eu),eA=eN(ec),eg=eN(ed),ev=er?er.prototype:void 0,eC=ev?ev.valueOf:void 0,eB=ev?ev.toString:void 0;function ey(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eb(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ex(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function eE(e){var t=-1,r=e?e.length:0;for(this.__data__=new ex;++t<r;)this.add(e[t])}function eS(e){this.__data__=new eb(e)}function eF(e,t){for(var r=e.length;r--;)if(eK(e[r][0],t))return r;return -1}ey.prototype.clear=function(){this.__data__=ef?ef(null):{}},ey.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ey.prototype.get=function(e){var t=this.__data__;if(ef){var r=t[e];return r===s?void 0:r}return $.call(t,e)?t[e]:void 0},ey.prototype.has=function(e){var t=this.__data__;return ef?void 0!==t[e]:$.call(t,e)},ey.prototype.set=function(e,t){return this.__data__[e]=ef&&void 0===t?s:t,this},eb.prototype.clear=function(){this.__data__=[]},eb.prototype.delete=function(e){var t=this.__data__,r=eF(t,e);return!(r<0)&&(r==t.length-1?t.pop():ea.call(t,r,1),!0)},eb.prototype.get=function(e){var t=this.__data__,r=eF(t,e);return r<0?void 0:t[r][1]},eb.prototype.has=function(e){return eF(this.__data__,e)>-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eF(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ex.prototype.clear=function(){this.__data__={hash:new ey,map:new(el||eb),string:new ey}},ex.prototype.delete=function(e){return eL(this,e).delete(e)},ex.prototype.get=function(e){return eL(this,e).get(e)},ex.prototype.has=function(e){return eL(this,e).has(e)},ex.prototype.set=function(e,t){return eL(this,e).set(e,t),this},eE.prototype.add=eE.prototype.push=function(e){return this.__data__.set(e,s),this},eE.prototype.has=function(e){return this.__data__.has(e)},eS.prototype.clear=function(){this.__data__=new eb},eS.prototype.delete=function(e){return this.__data__.delete(e)},eS.prototype.get=function(e){return this.__data__.get(e)},eS.prototype.has=function(e){return this.__data__.has(e)},eS.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!el||n.length<199)return n.push([e,t]),this;r=this.__data__=new ex(n)}return r.set(e,t),this};var eM=(n=function(e,t){return e&&eT(e,t,e0)},function(e,t){if(null==e)return e;if(!eq(e))return n(e,t);for(var r=e.length,i=-1,a=Object(e);++i<r&&!1!==t(a[i],i,a););return e}),eT=function(e,t,r){for(var n=-1,i=Object(e),a=r(e),o=a.length;o--;){var s=a[++n];if(!1===t(i[s],s,i))break}return e};function eR(e,t){var r;t=eH(t,e)?[t]:eV(r=t)?r:eU(r);for(var n=0,i=t.length;null!=e&&n<i;)e=e[ej(t[n++])];return n&&n==i?e:void 0}function ew(e,t){return null!=e&&t in Object(e)}function eD(e,t,r,n,i){return e===t||(null!=e&&null!=t&&(eY(e)||ez(t))?function(e,t,r,n,i,a){var o=eV(e),s=eV(t),l=c,m=c;o||(l=(l=e_(e))==u?g:l),s||(m=(m=e_(t))==u?g:m);var v=l==g&&!K(e),x=m==g&&!K(t),F=l==m;if(F&&!v)return a||(a=new eS),o||e$(e)?eG(e,t,r,n,i,a):function(e,t,r,n,i,a,o){switch(r){case S:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case E:if(e.byteLength!=t.byteLength||!n(new en(e),new en(t)))break;return!0;case d:case f:case A:return eK(+e,+t);case h:return e.name==t.name&&e.message==t.message;case C:case y:return e==t+"";case p:var s=Q;case B:var l=2&a;if(s||(s=V),e.size!=t.size&&!l)break;var u=o.get(e);if(u)return u==t;a|=1,o.set(e,t);var c=eG(s(e),s(t),n,i,a,o);return o.delete(e),c;case b:if(eC)return eC.call(e)==eC.call(t)}return!1}(e,t,l,r,n,i,a);if(!(2&i)){var M=v&&$.call(e,"__wrapped__"),T=x&&$.call(t,"__wrapped__");if(M||T){var R=M?e.value():e,w=T?t.value():t;return a||(a=new eS),r(R,w,n,i,a)}}return!!F&&(a||(a=new eS),function(e,t,r,n,i,a){var o=2&i,s=e0(e),l=s.length;if(l!=e0(t).length&&!o)return!1;for(var u=l;u--;){var c=s[u];if(!(o?c in t:$.call(t,c)))return!1}var d=a.get(e);if(d&&a.get(t))return d==t;var f=!0;a.set(e,t),a.set(t,e);for(var h=o;++u<l;){var m=e[c=s[u]],p=t[c];if(n)var A=o?n(p,m,c,t,e,a):n(m,p,c,e,t,a);if(!(void 0===A?m===p||r(m,p,n,i,a):A)){f=!1;break}h||(h="constructor"==c)}if(f&&!h){var g=e.constructor,v=t.constructor;g!=v&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof v&&v instanceof v)&&(f=!1)}return a.delete(e),a.delete(t),f}(e,t,r,n,i,a))}(e,t,eD,r,n,i):e!=e&&t!=t)}function eI(e){var t,r,n,i;return"function"==typeof e?e:null==e?e1:"object"==typeof e?eV(e)?(t=e[0],r=e[1],eH(t)&&function(e){return e==e&&!eY(e)}(r)?ek(ej(t),r):function(e){var n,i,a,o,s,l=(n=e,i=t,void 0===(a=null==n?void 0:eR(n,i))?void 0:a);return void 0===l&&l===r?(o=e,s=t,null!=o&&function(e,t,r){t=eH(t,e)?[t]:eV(n=t)?n:eU(n);for(var n,i,a=-1,o=t.length;++a<o;){var s=ej(t[a]);if(!(i=null!=e&&r(e,s)))break;e=e[s]}if(i)return i;var o=e?e.length:0;return!!o&&eW(o)&&eP(s,o)&&(eV(e)||eQ(e))}(o,s,ew)):eD(r,l,void 0,3)}):1==(i=function(e){for(var t=e0(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,function(e){return e==e&&!eY(e)}(i)]}return t}(n=e)).length&&i[0][2]?ek(i[0][0],i[0][1]):function(e){return e===n||function(e,t,r,n){var i=r.length,a=i;if(null==e)return!a;for(e=Object(e);i--;){var o=r[i];if((0,o[2])?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++i<a;){var s=(o=r[i])[0],l=e[s],u=o[1];if(0,o[2]){if(void 0===l&&!(s in e))return!1}else{var c,d=new eS;if(!(void 0===c?eD(u,l,void 0,3,d):c))return!1}}return!0}(e,0,i)}:function(e){var t;return eH(e)?(t=ej(e),function(e){return null==e?void 0:e[t]}):function(t){return eR(t,e)}}(e)}function eG(e,t,r,n,i,a){var o=2&i,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e);if(u&&a.get(t))return u==t;var c=-1,d=!0,f=1&i?new eE:void 0;for(a.set(e,t),a.set(t,e);++c<s;){var h=e[c],m=t[c];if(n)var p=o?n(m,h,c,t,e,a):n(h,m,c,e,t,a);if(void 0!==p){if(p)continue;d=!1;break}if(f){if(!function(e,t){for(var r=-1,n=e?e.length:0;++r<n;)if(t(e[r],r,e))return!0;return!1}(t,function(e,t){if(!f.has(t)&&(h===e||r(h,e,n,i,a)))return f.add(t)})){d=!1;break}}else if(!(h===m||r(h,m,n,i,a))){d=!1;break}}return a.delete(e),a.delete(t),d}function eL(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function eO(e,t){var r,n=null==e?void 0:e[t];return!(!eY(n)||(r=n,z&&z in r))&&(eX(n)||K(n)?et:D).test(eN(n))?n:void 0}var e_=function(e){return ee.call(e)};function eP(e,t){return!!(t=null==t?0x1fffffffffffff:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e<t}function eH(e,t){if(eV(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||eZ(e))||M.test(e)||!F.test(e)||null!=t&&e in Object(t)}function ek(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}}(es&&e_(new es(new ArrayBuffer(1)))!=S||el&&e_(new el)!=p||eu&&e_(eu.resolve())!=v||ec&&e_(new ec)!=B||ed&&e_(new ed)!=x)&&(e_=function(e){var t=ee.call(e),r=t==g?e.constructor:void 0,n=r?eN(r):void 0;if(n)switch(n){case eh:return S;case em:return p;case ep:return v;case eA:return B;case eg:return x}return t});var eU=eJ(function(e){e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(eZ(e))return eB?eB.call(e):"";var t=e+"";return"0"==t&&1/e==-l?"-0":t}(t);var t,r=[];return T.test(e)&&r.push(""),e.replace(R,function(e,t,n,i){r.push(n?i.replace(w,"$1"):t||e)}),r});function ej(e){if("string"==typeof e||eZ(e))return e;var t=e+"";return"0"==t&&1/e==-l?"-0":t}function eN(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eJ(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o),o};return r.cache=new(eJ.Cache||ex),r}function eK(e,t){return e===t||e!=e&&t!=t}function eQ(e){var t;return ez(t=e)&&eq(t)&&$.call(e,"callee")&&(!ei.call(e,"callee")||ee.call(e)==u)}eJ.Cache=ex;var eV=Array.isArray;function eq(e){return null!=e&&eW(e.length)&&!eX(e)}function eX(e){var t=eY(e)?ee.call(e):"";return t==m||"[object GeneratorFunction]"==t}function eW(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff}function eY(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ez(e){return!!e&&"object"==typeof e}function eZ(e){return"symbol"==typeof e||ez(e)&&ee.call(e)==b}var e$=j?J(j):function(e){return ez(e)&&eW(e.length)&&!!G[ee.call(e)]};function e0(e){return eq(e)?function(e,t){var r=eV(e)||eQ(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var a in e)$.call(e,a)&&!(i&&("length"==a||eP(a,n)))&&r.push(a);return r}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||W))return eo(e);var t,r,n=[];for(var i in Object(e))$.call(e,i)&&"constructor"!=i&&n.push(i);return n}(e)}function e1(e){return e}t.exports=function(e,t,r,n){return null==e?[]:(eV(t)||(t=null==t?[]:[t]),eV(r=n?void 0:r)||(r=null==r?[]:[r]),function(e,t,r){var n,i,a,o=-1;t=N(t.length?t:[e1],J(eI));var s=(n=function(e,r,n){return{criteria:N(t,function(t){return t(e)}),index:++o,value:e}},i=-1,a=eq(e)?Array(e.length):[],eM(e,function(e,t,r){a[++i]=n(e,t,r)}),a),l=s.length;for(s.sort(function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,a=t.criteria,o=i.length,s=r.length;++n<o;){var l=function(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,a=eZ(e),o=void 0!==t,s=null===t,l=t==t,u=eZ(t);if(!s&&!u&&!a&&e>t||a&&o&&l&&!s&&!u||n&&o&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e<t||u&&r&&i&&!n&&!a||s&&r&&i||!o&&i||!l)return -1}return 0}(i[n],a[n]);if(l){if(n>=s)return l;return l*("desc"==r[n]?-1:1)}}return e.index-t.index}(e,t,r)});l--;)s[l]=s[l].value;return s}(e,t,r))}},81405,(e,t,r)=>{var n;e.e,(n=function(){function e(e){return i.appendChild(e.dom),e}function t(e){for(var t=0;t<i.children.length;t++)i.children[t].style.display=t===e?"block":"none";r=e}var r=0,i=document.createElement("div");i.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",i.addEventListener("click",function(e){e.preventDefault(),t(++r%i.children.length)},!1);var a=(performance||Date).now(),o=a,s=0,l=e(new n.Panel("FPS","#0ff","#002")),u=e(new n.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=e(new n.Panel("MB","#f08","#201"));return t(0),{REVISION:16,dom:i,addPanel:e,showPanel:t,begin:function(){a=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(u.update(e-a,200),e>o+1e3&&(l.update(1e3*s/(e-o),100),o=e,s=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:t}}).Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,l=48*o,u=3*o,c=2*o,d=3*o,f=15*o,h=74*o,m=30*o,p=document.createElement("canvas");p.width=s,p.height=l,p.style.cssText="width:80px;height:48px";var A=p.getContext("2d");return A.font="bold "+9*o+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=r,A.fillRect(0,0,s,l),A.fillStyle=t,A.fillText(e,u,c),A.fillRect(d,f,h,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d,f,h,m),{dom:p,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),A.fillStyle=r,A.globalAlpha=1,A.fillRect(0,0,s,f),A.fillStyle=t,A.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),A.drawImage(p,d+o,f,h-o,m,d,f,h-o,m),A.fillRect(d+h-o,f,o,m),A.fillStyle=r,A.globalAlpha=.9,A.fillRect(d+h-o,f,o,a((1-l/g)*m))}}},t.exports=n},31713,e=>{"use strict";let t,r,n,i,a,o,s,l;var u,c,d=e.i(43476),f=e.i(932),h=e.i(71645),m=e.i(91037),p=e.i(8560),A=e.i(90072);e.s(["ACESFilmicToneMapping",()=>A.ACESFilmicToneMapping,"AddEquation",()=>A.AddEquation,"AddOperation",()=>A.AddOperation,"AdditiveAnimationBlendMode",()=>A.AdditiveAnimationBlendMode,"AdditiveBlending",()=>A.AdditiveBlending,"AgXToneMapping",()=>A.AgXToneMapping,"AlphaFormat",()=>A.AlphaFormat,"AlwaysCompare",()=>A.AlwaysCompare,"AlwaysDepth",()=>A.AlwaysDepth,"AlwaysStencilFunc",()=>A.AlwaysStencilFunc,"AmbientLight",()=>A.AmbientLight,"AnimationAction",()=>A.AnimationAction,"AnimationClip",()=>A.AnimationClip,"AnimationLoader",()=>A.AnimationLoader,"AnimationMixer",()=>A.AnimationMixer,"AnimationObjectGroup",()=>A.AnimationObjectGroup,"AnimationUtils",()=>A.AnimationUtils,"ArcCurve",()=>A.ArcCurve,"ArrayCamera",()=>A.ArrayCamera,"ArrowHelper",()=>A.ArrowHelper,"AttachedBindMode",()=>A.AttachedBindMode,"Audio",()=>A.Audio,"AudioAnalyser",()=>A.AudioAnalyser,"AudioContext",()=>A.AudioContext,"AudioListener",()=>A.AudioListener,"AudioLoader",()=>A.AudioLoader,"AxesHelper",()=>A.AxesHelper,"BackSide",()=>A.BackSide,"BasicDepthPacking",()=>A.BasicDepthPacking,"BasicShadowMap",()=>A.BasicShadowMap,"BatchedMesh",()=>A.BatchedMesh,"Bone",()=>A.Bone,"BooleanKeyframeTrack",()=>A.BooleanKeyframeTrack,"Box2",()=>A.Box2,"Box3",()=>A.Box3,"Box3Helper",()=>A.Box3Helper,"BoxGeometry",()=>A.BoxGeometry,"BoxHelper",()=>A.BoxHelper,"BufferAttribute",()=>A.BufferAttribute,"BufferGeometry",()=>A.BufferGeometry,"BufferGeometryLoader",()=>A.BufferGeometryLoader,"ByteType",()=>A.ByteType,"Cache",()=>A.Cache,"Camera",()=>A.Camera,"CameraHelper",()=>A.CameraHelper,"CanvasTexture",()=>A.CanvasTexture,"CapsuleGeometry",()=>A.CapsuleGeometry,"CatmullRomCurve3",()=>A.CatmullRomCurve3,"CineonToneMapping",()=>A.CineonToneMapping,"CircleGeometry",()=>A.CircleGeometry,"ClampToEdgeWrapping",()=>A.ClampToEdgeWrapping,"Clock",()=>A.Clock,"Color",()=>A.Color,"ColorKeyframeTrack",()=>A.ColorKeyframeTrack,"ColorManagement",()=>A.ColorManagement,"CompressedArrayTexture",()=>A.CompressedArrayTexture,"CompressedCubeTexture",()=>A.CompressedCubeTexture,"CompressedTexture",()=>A.CompressedTexture,"CompressedTextureLoader",()=>A.CompressedTextureLoader,"ConeGeometry",()=>A.ConeGeometry,"ConstantAlphaFactor",()=>A.ConstantAlphaFactor,"ConstantColorFactor",()=>A.ConstantColorFactor,"Controls",()=>A.Controls,"CubeCamera",()=>A.CubeCamera,"CubeDepthTexture",()=>A.CubeDepthTexture,"CubeReflectionMapping",()=>A.CubeReflectionMapping,"CubeRefractionMapping",()=>A.CubeRefractionMapping,"CubeTexture",()=>A.CubeTexture,"CubeTextureLoader",()=>A.CubeTextureLoader,"CubeUVReflectionMapping",()=>A.CubeUVReflectionMapping,"CubicBezierCurve",()=>A.CubicBezierCurve,"CubicBezierCurve3",()=>A.CubicBezierCurve3,"CubicInterpolant",()=>A.CubicInterpolant,"CullFaceBack",()=>A.CullFaceBack,"CullFaceFront",()=>A.CullFaceFront,"CullFaceFrontBack",()=>A.CullFaceFrontBack,"CullFaceNone",()=>A.CullFaceNone,"Curve",()=>A.Curve,"CurvePath",()=>A.CurvePath,"CustomBlending",()=>A.CustomBlending,"CustomToneMapping",()=>A.CustomToneMapping,"CylinderGeometry",()=>A.CylinderGeometry,"Cylindrical",()=>A.Cylindrical,"Data3DTexture",()=>A.Data3DTexture,"DataArrayTexture",()=>A.DataArrayTexture,"DataTexture",()=>A.DataTexture,"DataTextureLoader",()=>A.DataTextureLoader,"DataUtils",()=>A.DataUtils,"DecrementStencilOp",()=>A.DecrementStencilOp,"DecrementWrapStencilOp",()=>A.DecrementWrapStencilOp,"DefaultLoadingManager",()=>A.DefaultLoadingManager,"DepthFormat",()=>A.DepthFormat,"DepthStencilFormat",()=>A.DepthStencilFormat,"DepthTexture",()=>A.DepthTexture,"DetachedBindMode",()=>A.DetachedBindMode,"DirectionalLight",()=>A.DirectionalLight,"DirectionalLightHelper",()=>A.DirectionalLightHelper,"DiscreteInterpolant",()=>A.DiscreteInterpolant,"DodecahedronGeometry",()=>A.DodecahedronGeometry,"DoubleSide",()=>A.DoubleSide,"DstAlphaFactor",()=>A.DstAlphaFactor,"DstColorFactor",()=>A.DstColorFactor,"DynamicCopyUsage",()=>A.DynamicCopyUsage,"DynamicDrawUsage",()=>A.DynamicDrawUsage,"DynamicReadUsage",()=>A.DynamicReadUsage,"EdgesGeometry",()=>A.EdgesGeometry,"EllipseCurve",()=>A.EllipseCurve,"EqualCompare",()=>A.EqualCompare,"EqualDepth",()=>A.EqualDepth,"EqualStencilFunc",()=>A.EqualStencilFunc,"EquirectangularReflectionMapping",()=>A.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>A.EquirectangularRefractionMapping,"Euler",()=>A.Euler,"EventDispatcher",()=>A.EventDispatcher,"ExternalTexture",()=>A.ExternalTexture,"ExtrudeGeometry",()=>A.ExtrudeGeometry,"FileLoader",()=>A.FileLoader,"Float16BufferAttribute",()=>A.Float16BufferAttribute,"Float32BufferAttribute",()=>A.Float32BufferAttribute,"FloatType",()=>A.FloatType,"Fog",()=>A.Fog,"FogExp2",()=>A.FogExp2,"FramebufferTexture",()=>A.FramebufferTexture,"FrontSide",()=>A.FrontSide,"Frustum",()=>A.Frustum,"FrustumArray",()=>A.FrustumArray,"GLBufferAttribute",()=>A.GLBufferAttribute,"GLSL1",()=>A.GLSL1,"GLSL3",()=>A.GLSL3,"GreaterCompare",()=>A.GreaterCompare,"GreaterDepth",()=>A.GreaterDepth,"GreaterEqualCompare",()=>A.GreaterEqualCompare,"GreaterEqualDepth",()=>A.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>A.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>A.GreaterStencilFunc,"GridHelper",()=>A.GridHelper,"Group",()=>A.Group,"HalfFloatType",()=>A.HalfFloatType,"HemisphereLight",()=>A.HemisphereLight,"HemisphereLightHelper",()=>A.HemisphereLightHelper,"IcosahedronGeometry",()=>A.IcosahedronGeometry,"ImageBitmapLoader",()=>A.ImageBitmapLoader,"ImageLoader",()=>A.ImageLoader,"ImageUtils",()=>A.ImageUtils,"IncrementStencilOp",()=>A.IncrementStencilOp,"IncrementWrapStencilOp",()=>A.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>A.InstancedBufferAttribute,"InstancedBufferGeometry",()=>A.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>A.InstancedInterleavedBuffer,"InstancedMesh",()=>A.InstancedMesh,"Int16BufferAttribute",()=>A.Int16BufferAttribute,"Int32BufferAttribute",()=>A.Int32BufferAttribute,"Int8BufferAttribute",()=>A.Int8BufferAttribute,"IntType",()=>A.IntType,"InterleavedBuffer",()=>A.InterleavedBuffer,"InterleavedBufferAttribute",()=>A.InterleavedBufferAttribute,"Interpolant",()=>A.Interpolant,"InterpolateDiscrete",()=>A.InterpolateDiscrete,"InterpolateLinear",()=>A.InterpolateLinear,"InterpolateSmooth",()=>A.InterpolateSmooth,"InterpolationSamplingMode",()=>A.InterpolationSamplingMode,"InterpolationSamplingType",()=>A.InterpolationSamplingType,"InvertStencilOp",()=>A.InvertStencilOp,"KeepStencilOp",()=>A.KeepStencilOp,"KeyframeTrack",()=>A.KeyframeTrack,"LOD",()=>A.LOD,"LatheGeometry",()=>A.LatheGeometry,"Layers",()=>A.Layers,"LessCompare",()=>A.LessCompare,"LessDepth",()=>A.LessDepth,"LessEqualCompare",()=>A.LessEqualCompare,"LessEqualDepth",()=>A.LessEqualDepth,"LessEqualStencilFunc",()=>A.LessEqualStencilFunc,"LessStencilFunc",()=>A.LessStencilFunc,"Light",()=>A.Light,"LightProbe",()=>A.LightProbe,"Line",()=>A.Line,"Line3",()=>A.Line3,"LineBasicMaterial",()=>A.LineBasicMaterial,"LineCurve",()=>A.LineCurve,"LineCurve3",()=>A.LineCurve3,"LineDashedMaterial",()=>A.LineDashedMaterial,"LineLoop",()=>A.LineLoop,"LineSegments",()=>A.LineSegments,"LinearFilter",()=>A.LinearFilter,"LinearInterpolant",()=>A.LinearInterpolant,"LinearMipMapLinearFilter",()=>A.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>A.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>A.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>A.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>A.LinearSRGBColorSpace,"LinearToneMapping",()=>A.LinearToneMapping,"LinearTransfer",()=>A.LinearTransfer,"Loader",()=>A.Loader,"LoaderUtils",()=>A.LoaderUtils,"LoadingManager",()=>A.LoadingManager,"LoopOnce",()=>A.LoopOnce,"LoopPingPong",()=>A.LoopPingPong,"LoopRepeat",()=>A.LoopRepeat,"MOUSE",()=>A.MOUSE,"Material",()=>A.Material,"MaterialLoader",()=>A.MaterialLoader,"MathUtils",()=>A.MathUtils,"Matrix2",()=>A.Matrix2,"Matrix3",()=>A.Matrix3,"Matrix4",()=>A.Matrix4,"MaxEquation",()=>A.MaxEquation,"Mesh",()=>A.Mesh,"MeshBasicMaterial",()=>A.MeshBasicMaterial,"MeshDepthMaterial",()=>A.MeshDepthMaterial,"MeshDistanceMaterial",()=>A.MeshDistanceMaterial,"MeshLambertMaterial",()=>A.MeshLambertMaterial,"MeshMatcapMaterial",()=>A.MeshMatcapMaterial,"MeshNormalMaterial",()=>A.MeshNormalMaterial,"MeshPhongMaterial",()=>A.MeshPhongMaterial,"MeshPhysicalMaterial",()=>A.MeshPhysicalMaterial,"MeshStandardMaterial",()=>A.MeshStandardMaterial,"MeshToonMaterial",()=>A.MeshToonMaterial,"MinEquation",()=>A.MinEquation,"MirroredRepeatWrapping",()=>A.MirroredRepeatWrapping,"MixOperation",()=>A.MixOperation,"MultiplyBlending",()=>A.MultiplyBlending,"MultiplyOperation",()=>A.MultiplyOperation,"NearestFilter",()=>A.NearestFilter,"NearestMipMapLinearFilter",()=>A.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>A.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>A.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>A.NearestMipmapNearestFilter,"NeutralToneMapping",()=>A.NeutralToneMapping,"NeverCompare",()=>A.NeverCompare,"NeverDepth",()=>A.NeverDepth,"NeverStencilFunc",()=>A.NeverStencilFunc,"NoBlending",()=>A.NoBlending,"NoColorSpace",()=>A.NoColorSpace,"NoNormalPacking",()=>A.NoNormalPacking,"NoToneMapping",()=>A.NoToneMapping,"NormalAnimationBlendMode",()=>A.NormalAnimationBlendMode,"NormalBlending",()=>A.NormalBlending,"NormalGAPacking",()=>A.NormalGAPacking,"NormalRGPacking",()=>A.NormalRGPacking,"NotEqualCompare",()=>A.NotEqualCompare,"NotEqualDepth",()=>A.NotEqualDepth,"NotEqualStencilFunc",()=>A.NotEqualStencilFunc,"NumberKeyframeTrack",()=>A.NumberKeyframeTrack,"Object3D",()=>A.Object3D,"ObjectLoader",()=>A.ObjectLoader,"ObjectSpaceNormalMap",()=>A.ObjectSpaceNormalMap,"OctahedronGeometry",()=>A.OctahedronGeometry,"OneFactor",()=>A.OneFactor,"OneMinusConstantAlphaFactor",()=>A.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>A.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>A.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>A.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>A.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>A.OneMinusSrcColorFactor,"OrthographicCamera",()=>A.OrthographicCamera,"PCFShadowMap",()=>A.PCFShadowMap,"PCFSoftShadowMap",()=>A.PCFSoftShadowMap,"PMREMGenerator",()=>p.PMREMGenerator,"Path",()=>A.Path,"PerspectiveCamera",()=>A.PerspectiveCamera,"Plane",()=>A.Plane,"PlaneGeometry",()=>A.PlaneGeometry,"PlaneHelper",()=>A.PlaneHelper,"PointLight",()=>A.PointLight,"PointLightHelper",()=>A.PointLightHelper,"Points",()=>A.Points,"PointsMaterial",()=>A.PointsMaterial,"PolarGridHelper",()=>A.PolarGridHelper,"PolyhedronGeometry",()=>A.PolyhedronGeometry,"PositionalAudio",()=>A.PositionalAudio,"PropertyBinding",()=>A.PropertyBinding,"PropertyMixer",()=>A.PropertyMixer,"QuadraticBezierCurve",()=>A.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>A.QuadraticBezierCurve3,"Quaternion",()=>A.Quaternion,"QuaternionKeyframeTrack",()=>A.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>A.QuaternionLinearInterpolant,"R11_EAC_Format",()=>A.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>A.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>A.RED_RGTC1_Format,"REVISION",()=>A.REVISION,"RG11_EAC_Format",()=>A.RG11_EAC_Format,"RGBADepthPacking",()=>A.RGBADepthPacking,"RGBAFormat",()=>A.RGBAFormat,"RGBAIntegerFormat",()=>A.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>A.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>A.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>A.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>A.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>A.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>A.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>A.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>A.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>A.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>A.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>A.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>A.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>A.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>A.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>A.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>A.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>A.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>A.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>A.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>A.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>A.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>A.RGBDepthPacking,"RGBFormat",()=>A.RGBFormat,"RGBIntegerFormat",()=>A.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>A.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>A.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>A.RGB_ETC1_Format,"RGB_ETC2_Format",()=>A.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>A.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>A.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>A.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>A.RGDepthPacking,"RGFormat",()=>A.RGFormat,"RGIntegerFormat",()=>A.RGIntegerFormat,"RawShaderMaterial",()=>A.RawShaderMaterial,"Ray",()=>A.Ray,"Raycaster",()=>A.Raycaster,"RectAreaLight",()=>A.RectAreaLight,"RedFormat",()=>A.RedFormat,"RedIntegerFormat",()=>A.RedIntegerFormat,"ReinhardToneMapping",()=>A.ReinhardToneMapping,"RenderTarget",()=>A.RenderTarget,"RenderTarget3D",()=>A.RenderTarget3D,"RepeatWrapping",()=>A.RepeatWrapping,"ReplaceStencilOp",()=>A.ReplaceStencilOp,"ReverseSubtractEquation",()=>A.ReverseSubtractEquation,"RingGeometry",()=>A.RingGeometry,"SIGNED_R11_EAC_Format",()=>A.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>A.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>A.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>A.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>A.SRGBColorSpace,"SRGBTransfer",()=>A.SRGBTransfer,"Scene",()=>A.Scene,"ShaderChunk",()=>p.ShaderChunk,"ShaderLib",()=>p.ShaderLib,"ShaderMaterial",()=>A.ShaderMaterial,"ShadowMaterial",()=>A.ShadowMaterial,"Shape",()=>A.Shape,"ShapeGeometry",()=>A.ShapeGeometry,"ShapePath",()=>A.ShapePath,"ShapeUtils",()=>A.ShapeUtils,"ShortType",()=>A.ShortType,"Skeleton",()=>A.Skeleton,"SkeletonHelper",()=>A.SkeletonHelper,"SkinnedMesh",()=>A.SkinnedMesh,"Source",()=>A.Source,"Sphere",()=>A.Sphere,"SphereGeometry",()=>A.SphereGeometry,"Spherical",()=>A.Spherical,"SphericalHarmonics3",()=>A.SphericalHarmonics3,"SplineCurve",()=>A.SplineCurve,"SpotLight",()=>A.SpotLight,"SpotLightHelper",()=>A.SpotLightHelper,"Sprite",()=>A.Sprite,"SpriteMaterial",()=>A.SpriteMaterial,"SrcAlphaFactor",()=>A.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>A.SrcAlphaSaturateFactor,"SrcColorFactor",()=>A.SrcColorFactor,"StaticCopyUsage",()=>A.StaticCopyUsage,"StaticDrawUsage",()=>A.StaticDrawUsage,"StaticReadUsage",()=>A.StaticReadUsage,"StereoCamera",()=>A.StereoCamera,"StreamCopyUsage",()=>A.StreamCopyUsage,"StreamDrawUsage",()=>A.StreamDrawUsage,"StreamReadUsage",()=>A.StreamReadUsage,"StringKeyframeTrack",()=>A.StringKeyframeTrack,"SubtractEquation",()=>A.SubtractEquation,"SubtractiveBlending",()=>A.SubtractiveBlending,"TOUCH",()=>A.TOUCH,"TangentSpaceNormalMap",()=>A.TangentSpaceNormalMap,"TetrahedronGeometry",()=>A.TetrahedronGeometry,"Texture",()=>A.Texture,"TextureLoader",()=>A.TextureLoader,"TextureUtils",()=>A.TextureUtils,"Timer",()=>A.Timer,"TimestampQuery",()=>A.TimestampQuery,"TorusGeometry",()=>A.TorusGeometry,"TorusKnotGeometry",()=>A.TorusKnotGeometry,"Triangle",()=>A.Triangle,"TriangleFanDrawMode",()=>A.TriangleFanDrawMode,"TriangleStripDrawMode",()=>A.TriangleStripDrawMode,"TrianglesDrawMode",()=>A.TrianglesDrawMode,"TubeGeometry",()=>A.TubeGeometry,"UVMapping",()=>A.UVMapping,"Uint16BufferAttribute",()=>A.Uint16BufferAttribute,"Uint32BufferAttribute",()=>A.Uint32BufferAttribute,"Uint8BufferAttribute",()=>A.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>A.Uint8ClampedBufferAttribute,"Uniform",()=>A.Uniform,"UniformsGroup",()=>A.UniformsGroup,"UniformsLib",()=>p.UniformsLib,"UniformsUtils",()=>A.UniformsUtils,"UnsignedByteType",()=>A.UnsignedByteType,"UnsignedInt101111Type",()=>A.UnsignedInt101111Type,"UnsignedInt248Type",()=>A.UnsignedInt248Type,"UnsignedInt5999Type",()=>A.UnsignedInt5999Type,"UnsignedIntType",()=>A.UnsignedIntType,"UnsignedShort4444Type",()=>A.UnsignedShort4444Type,"UnsignedShort5551Type",()=>A.UnsignedShort5551Type,"UnsignedShortType",()=>A.UnsignedShortType,"VSMShadowMap",()=>A.VSMShadowMap,"Vector2",()=>A.Vector2,"Vector3",()=>A.Vector3,"Vector4",()=>A.Vector4,"VectorKeyframeTrack",()=>A.VectorKeyframeTrack,"VideoFrameTexture",()=>A.VideoFrameTexture,"VideoTexture",()=>A.VideoTexture,"WebGL3DRenderTarget",()=>A.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>A.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>A.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>A.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>A.WebGLRenderTarget,"WebGLRenderer",()=>p.WebGLRenderer,"WebGLUtils",()=>p.WebGLUtils,"WebGPUCoordinateSystem",()=>A.WebGPUCoordinateSystem,"WebXRController",()=>A.WebXRController,"WireframeGeometry",()=>A.WireframeGeometry,"WrapAroundEnding",()=>A.WrapAroundEnding,"ZeroCurvatureEnding",()=>A.ZeroCurvatureEnding,"ZeroFactor",()=>A.ZeroFactor,"ZeroSlopeEnding",()=>A.ZeroSlopeEnding,"ZeroStencilOp",()=>A.ZeroStencilOp,"createCanvasElement",()=>A.createCanvasElement,"error",()=>A.error,"getConsoleFunction",()=>A.getConsoleFunction,"log",()=>A.log,"setConsoleFunction",()=>A.setConsoleFunction,"warn",()=>A.warn,"warnOnce",()=>A.warnOnce],32009);var g=e.i(32009);function v(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let C=["x","y","top","bottom","left","right","width","height"];var B=e.i(46791);function y({ref:e,children:t,fallback:r,resize:n,style:i,gl:a,events:o=m.f,eventSource:s,eventPrefix:l,shadows:u,linear:c,flat:f,legacy:p,orthographic:A,frameloop:B,dpr:y,performance:b,raycaster:x,camera:E,scene:S,onPointerMissed:F,onCreated:M,...T}){h.useMemo(()=>(0,m.e)(g),[]);let R=(0,m.u)(),[w,D]=function({debounce:e,scroll:t,polyfill:r,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){var i,a,o;let s=r||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,h.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,h.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=e?"number"==typeof e?e:e.scroll:null,f=e?"number"==typeof e?e:e.resize:null,m=(0,h.useRef)(!1);(0,h.useEffect)(()=>(m.current=!0,()=>void(m.current=!1)));let[p,A,g]=(0,h.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:r,top:i,width:a,height:o,bottom:s,right:l,x:d,y:f}=c.current.element.getBoundingClientRect(),h={left:r,top:i,width:a,height:o,bottom:s,right:l,x:d,y:f};c.current.element instanceof HTMLElement&&n&&(h.height=c.current.element.offsetHeight,h.width=c.current.element.offsetWidth),Object.freeze(h),m.current&&(e=c.current.lastBounds,t=h,!C.every(r=>e[r]===t[r]))&&u(c.current.lastBounds=h)};return[e,f?v(e,f):e,d?v(e,d):e]},[u,n,d,f]);function B(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function y(){c.current.element&&(c.current.resizeObserver=new s(g),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return i=g,a=!!t,(0,h.useEffect)(()=>{if(a)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,a]),o=A,(0,h.useEffect)(()=>(window.addEventListener("resize",o),()=>void window.removeEventListener("resize",o)),[o]),(0,h.useEffect)(()=>{B(),y()},[t,g,A]),(0,h.useEffect)(()=>B,[]),[e=>{e&&e!==c.current.element&&(B(),c.current.element=e,c.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:n,overflowX:i,overflowY:a}=window.getComputedStyle(t);return[n,i,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},l,p]}({scroll:!0,debounce:{scroll:50,resize:0},...n}),I=h.useRef(null),G=h.useRef(null);h.useImperativeHandle(e,()=>I.current);let L=(0,m.a)(F),[O,_]=h.useState(!1),[P,H]=h.useState(!1);if(O)throw O;if(P)throw P;let k=h.useRef(null);(0,m.b)(()=>{let e=I.current;D.width>0&&D.height>0&&e&&(k.current||(k.current=(0,m.c)(e)),async function(){await k.current.configure({gl:a,scene:S,events:o,shadows:u,linear:c,flat:f,legacy:p,orthographic:A,frameloop:B,dpr:y,performance:b,raycaster:x,camera:E,size:D,onPointerMissed:(...e)=>null==L.current?void 0:L.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(s?(0,m.i)(s)?s.current:s:G.current),l&&e.setEvents({compute:(e,t)=>{let r=e[l+"X"],n=e[l+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(n/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==M||M(e)}}),k.current.render((0,d.jsx)(R,{children:(0,d.jsx)(m.E,{set:H,children:(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)(m.B,{set:_}),children:null!=t?t:null})})}))}())}),h.useEffect(()=>{let e=I.current;if(e)return()=>(0,m.d)(e)},[]);let U=s?"none":"auto";return(0,d.jsx)("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:U,...i},...T,children:(0,d.jsx)("div",{ref:w,style:{width:"100%",height:"100%"},children:(0,d.jsx)("canvas",{ref:I,style:{display:"block"},children:r})})})}function b(e){return(0,d.jsx)(B.FiberProvider,{children:(0,d.jsx)(y,{...e})})}e.i(39695),e.i(98133),e.i(95087);var x=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(){}};e.i(47167);var E={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},S=new class{#e=E;#t=!1;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)}},F="undefined"==typeof window||"Deno"in globalThis;function M(){}function T(e){return"number"==typeof e&&e>=0&&e!==1/0}function R(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return"function"==typeof e?e(t):e}function D(e,t){return"function"==typeof e?e(t):e}function I(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==L(o,t.options))return!1}else if(!_(t.queryKey,o))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof s||t.isStale()===s)&&(!i||i===t.state.fetchStatus)&&(!a||!!a(t))}function G(e,t){let{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(O(t.options.mutationKey)!==O(a))return!1}else if(!_(t.options.mutationKey,a))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function L(e,t){return(t?.queryKeyHashFn||O)(e)}function O(e){return JSON.stringify(e,(e,t)=>U(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function _(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>_(e[r],t[r]))}var P=Object.prototype.hasOwnProperty;function H(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function k(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function U(e){if(!j(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!j(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function j(e){return"[object Object]"===Object.prototype.toString.call(e)}function N(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=k(t)&&k(r);if(!n&&!(U(t)&&U(r)))return r;let i=(n?t:Object.keys(t)).length,a=n?r:Object.keys(r),o=a.length,s=n?Array(o):{},l=0;for(let u=0;u<o;u++){let o=n?u:a[u],c=t[o],d=r[o];if(c===d){s[o]=c,(n?u<i:P.call(t,o))&&l++;continue}if(null===c||null===d||"object"!=typeof c||"object"!=typeof d){s[o]=d;continue}let f=e(c,d);s[o]=f,f===c&&l++}return i===o&&l===i?t:s}(e,t):t}function J(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function K(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Q=Symbol();function V(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==Q?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}var q=new class extends x{#r;#n;#i;constructor(){super(),this.#i=e=>{if(!F&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:globalThis.document?.visibilityState!=="hidden"}},X=(r=[],n=0,i=e=>{e()},a=e=>{e()},o=function(e){setTimeout(e,0)},{batch:e=>{let t;n++;try{t=e()}finally{let e;--n||(e=r,r=[],e.length&&o(()=>{a(()=>{e.forEach(e=>{i(e)})})}))}return t},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s=e=>{n?r.push(e):o(()=>{i(e)})},setNotifyFunction:e=>{i=e},setBatchNotifyFunction:e=>{a=e},setScheduler:e=>{o=e}}),W=new class extends x{#a=!0;#n;#i;constructor(){super(),this.#i=e=>{if(!F&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#n||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#i=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#a!==e&&(this.#a=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#a}};function Y(){let e,t,r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function z(e){return Math.min(1e3*2**e,3e4)}function Z(e){return(e??"online")!=="online"||W.isOnline()}var $=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ee(e){let t,r=!1,n=0,i=Y(),a=()=>q.isFocused()&&("always"===e.networkMode||W.isOnline())&&e.canRun(),o=()=>Z(e.networkMode)&&e.canRun(),s=e=>{"pending"===i.status&&(t?.(),i.resolve(e))},l=e=>{"pending"===i.status&&(t?.(),i.reject(e))},u=()=>new Promise(r=>{t=e=>{("pending"!==i.status||a())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,"pending"===i.status&&e.onContinue?.()}),c=()=>{let t;if("pending"!==i.status)return;let o=0===n?e.initialPromise:void 0;try{t=o??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(s).catch(t=>{if("pending"!==i.status)return;let o=e.retry??3*!F,s=e.retryDelay??z,d="function"==typeof s?s(n,t):s,f=!0===o||"number"==typeof o&&n<o||"function"==typeof o&&o(n,t);r||!f?l(t):(n++,e.onFail?.(n,t),new Promise(e=>{S.setTimeout(e,d)}).then(()=>a()?void 0:u()).then(()=>{r?l(t):c()}))})};return{promise:i,status:()=>i.status,cancel:t=>{if("pending"===i.status){let r=new $(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),i),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?c():u().then(c),i)}}var et=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#o=S.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(F?1/0:3e5))}clearGcTimeout(){this.#o&&(S.clearTimeout(this.#o),this.#o=void 0)}},er=class extends et{#s;#l;#u;#c;#d;#f;#h;constructor(e){super(),this.#h=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.client,this.#u=this.#c.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#s=ea(this.options),this.state=e.state??this.#s,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let e=ea(this.options);void 0!==e.data&&(this.setState(ei(e.data,e.dataUpdatedAt)),this.#s=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){let r=N(this.state.data,e,this.options);return this.#m({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#m({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#d?.promise;return this.#d?.cancel(e),t?t.then(M).catch(M):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#s)}isActive(){return this.observers.some(e=>!1!==D(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Q||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===w(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!R(this.state.dataUpdatedAt,e))}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.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.#d&&(this.#h?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#m({type:"invalidate"})}async fetch(e,t){let r;if("idle"!==this.state.fetchStatus&&this.#d?.status()!=="rejected"){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#d)return this.#d.continueRetry(),this.#d.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,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,n.signal)})},a=()=>{let e,r=V(this.options,t),n=(i(e={client:this.#c,queryKey:this.queryKey,meta:this.meta}),e);return(this.#h=!1,this.options.persister)?this.options.persister(r,n,this):r(n)},o=(i(r={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:a}),r);this.options.behavior?.onFetch(o,this),this.#l=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#m({type:"fetch",meta:o.fetchOptions?.meta}),this.#d=ee({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof $&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{let e=await this.#d.start();if(void 0===e)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof $){if(e.silent)return this.#d.promise;else if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#m({type:"error",error:e}),this.#u.config.onError?.(e,this),this.#u.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#m(e){let t=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,...en(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...ei(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":let n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),X.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function en(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function ei(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ea(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var eo=class extends x{constructor(e,t){super(),this.options=t,this.#c=e,this.#p=null,this.#A=Y(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#v=void 0;#C=void 0;#B;#y;#A;#p;#b;#x;#E;#S;#F;#M;#T=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),es(this.#g,this.options)?this.#R():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return el(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return el(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#D(),this.#I(),this.#g.removeObserver(this)}setOptions(e){let t=this.options,r=this.#g;if(this.options=this.#c.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof D(this.options.enabled,this.#g))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#G(),this.#g.setOptions(this.options),t._defaulted&&!H(this.options,t)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});let n=this.hasListeners();n&&eu(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),n&&(this.#g!==r||D(this.options.enabled,this.#g)!==D(t.enabled,this.#g)||w(this.options.staleTime,this.#g)!==w(t.staleTime,this.#g))&&this.#L();let i=this.#O();n&&(this.#g!==r||D(this.options.enabled,this.#g)!==D(t.enabled,this.#g)||i!==this.#M)&&this.#_(i)}getOptimisticResult(e){var t,r;let n=this.#c.getQueryCache().build(this.#c,e),i=this.createResult(n,e);return t=this,r=i,H(t.getCurrentResult(),r)||(this.#C=i,this.#y=this.options,this.#B=this.#g.state),i}getCurrentResult(){return this.#C}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#A.status||this.#A.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#T.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#c.defaultQueryOptions(e),r=this.#c.getQueryCache().build(this.#c,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#R({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#C))}#R(e){this.#G();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(M)),t}#L(){this.#D();let e=w(this.options.staleTime,this.#g);if(F||this.#C.isStale||!T(e))return;let t=R(this.#C.dataUpdatedAt,e);this.#S=S.setTimeout(()=>{this.#C.isStale||this.updateResult()},t+1)}#O(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#_(e){this.#I(),this.#M=e,!F&&!1!==D(this.options.enabled,this.#g)&&T(this.#M)&&0!==this.#M&&(this.#F=S.setInterval(()=>{(this.options.refetchIntervalInBackground||q.isFocused())&&this.#R()},this.#M))}#w(){this.#L(),this.#_(this.#O())}#D(){this.#S&&(S.clearTimeout(this.#S),this.#S=void 0)}#I(){this.#F&&(S.clearInterval(this.#F),this.#F=void 0)}createResult(e,t){let r,n=this.#g,i=this.options,a=this.#C,o=this.#B,s=this.#y,l=e!==n?e.state:this.#v,{state:u}=e,c={...u},d=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&es(e,t),o=r&&eu(e,n,t,i);(a||o)&&(c={...c,...en(u.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:f,errorUpdatedAt:h,status:m}=c;r=c.data;let p=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===m){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,p=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#E?.state.data,this.#E):t.placeholderData,void 0!==e&&(m="success",r=N(a?.data,e,t),d=!0)}if(t.select&&void 0!==r&&!p)if(a&&r===o?.data&&t.select===this.#b)r=this.#x;else try{this.#b=t.select,r=t.select(r),r=N(a?.data,r,t),this.#x=r,this.#p=null}catch(e){this.#p=e}this.#p&&(f=this.#p,r=this.#x,h=Date.now(),m="error");let A="fetching"===c.fetchStatus,g="pending"===m,v="error"===m,C=g&&A,B=void 0!==r,y={status:m,fetchStatus:c.fetchStatus,isPending:g,isSuccess:"success"===m,isError:v,isInitialLoading:C,isLoading:C,data:r,dataUpdatedAt:c.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:A,isRefetching:A&&!g,isLoadingError:v&&!B,isPaused:"paused"===c.fetchStatus,isPlaceholderData:d,isRefetchError:v&&B,isStale:ec(e,t),refetch:this.refetch,promise:this.#A,isEnabled:!1!==D(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=e=>{"error"===y.status?e.reject(y.error):void 0!==y.data&&e.resolve(y.data)},r=()=>{t(this.#A=y.promise=Y())},i=this.#A;switch(i.status){case"pending":e.queryHash===n.queryHash&&t(i);break;case"fulfilled":("error"===y.status||y.data!==i.value)&&r();break;case"rejected":("error"!==y.status||y.error!==i.reason)&&r()}}return y}updateResult(){let e=this.#C,t=this.createResult(this.#g,this.options);if(this.#B=this.#g.state,this.#y=this.options,void 0!==this.#B.data&&(this.#E=this.#g),H(t,e))return;this.#C=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#T.size)return!0;let n=new Set(r??this.#T);return this.options.throwOnError&&n.add("error"),Object.keys(this.#C).some(t=>this.#C[t]!==e[t]&&n.has(t))};this.#P({listeners:r()})}#G(){let e=this.#c.getQueryCache().build(this.#c,this.options);if(e===this.#g)return;let t=this.#g;this.#g=e,this.#v=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#w()}#P(e){X.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#C)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function es(e,t){return!1!==D(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&el(e,t,t.refetchOnMount)}function el(e,t,r){if(!1!==D(t.enabled,e)&&"static"!==w(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&ec(e,t)}return!1}function eu(e,t,r,n){return(e!==t||!1===D(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&ec(e,r)}function ec(e,t){return!1!==D(t.enabled,e)&&e.isStaleByTime(w(t.staleTime,e))}var ed=h.createContext(void 0),ef=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(ed.Provider,{value:e,children:t})),eh=h.createContext((l=!1,{clearReset:()=>{l=!1},reset:()=>{l=!0},isReset:()=>l})),em=h.createContext(!1);em.Provider;var ep=(e,t)=>void 0===t.state.data,eA=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function eg(e,t,r){let n=h.useContext(em),i=h.useContext(eh),a=(e=>{let t=h.useContext(ed);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t})(r),o=a.defaultQueryOptions(e);if(a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=n?"isRestoring":"optimistic",o.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=o.staleTime;o.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof o.gcTime&&(o.gcTime=Math.max(o.gcTime,1e3))}(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&!i.isReset()&&(o.retryOnMount=!1),h.useEffect(()=>{i.clearReset()},[i]);let s=!a.getQueryCache().get(o.queryHash),[l]=h.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),c=!n&&!1!==e.subscribed;if(h.useSyncExternalStore(h.useCallback(e=>{let t=c?l.subscribe(X.batchCalls(e)):M;return l.updateResult(),t},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(o)},[o,l]),o?.suspense&&u.isPending)throw eA(o,l,i);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>{var a;return e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&void 0===e.data||(a=[e.error,n],"function"==typeof r?r(...a):!!r))})({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if(a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!F&&u.isLoading&&u.isFetching&&!n){let e=s?eA(o,l,i):a.getQueryCache().get(o.queryHash)?.promise;e?.catch(M).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?u:l.trackResult(u)}var ev=e.i(54970),eC=e.i(12979),eB=e.i(49774),ey=e.i(73949),eb=e.i(62395),ex=e.i(75567),eE=e.i(47071);let eS={value:!0},eF=`
vec3 terrainLinearToSRGB(vec3 linear) {
vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055;
vec3 lower = linear * 12.92;
return mix(lower, higher, step(vec3(0.0031308), linear));
}
vec3 terrainSRGBToLinear(vec3 srgb) {
vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4));
vec3 lower = srgb / 12.92;
return mix(lower, higher, step(vec3(0.04045), srgb));
}
// Debug grid overlay using screen-space derivatives for sharp, anti-aliased lines
// Returns 1.0 on grid lines, 0.0 elsewhere
float terrainDebugGrid(vec2 uv, float gridSize, float lineWidth) {
vec2 scaledUV = uv * gridSize;
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
float line = min(grid.x, grid.y);
return 1.0 - min(line / lineWidth, 1.0);
}
`;var eM=e.i(79123),eT=e.i(47021),eR=e.i(48066);let ew={0:32,1:32,2:32,3:32,4:32,5:32};function eD({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:i,lightmap:a}){let{debugMode:o}=(0,eM.useDebug)(),s=(0,eE.useTexture)(r.map(e=>(0,eC.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,ex.setupTexture)(e))}),l=i?(0,eC.textureToUrl)(i):null,u=(0,eE.useTexture)(l??eC.FALLBACK_TEXTURE_URL,e=>{(0,ex.setupTexture)(e)}),c=(0,h.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:i,detailTexture:a=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=eS;let s=t.length;if(t.forEach((t,r)=>{e.uniforms[`albedo${r}`]={value:t}}),r.forEach((t,r)=>{e.uniforms[`mask${r}`]={value:t}}),n&&(e.uniforms.visibilityMask={value:n}),t.forEach((t,r)=>{e.uniforms[`tiling${r}`]={value:i[r]??32}}),o&&(e.uniforms.terrainLightmap={value:o}),a&&(e.uniforms.detailTexture={value:a},e.uniforms.detailTiling={value:64},e.uniforms.detailFadeDistance={value:150},e.vertexShader=e.vertexShader.replace("#include <common>",`#include <common>
varying vec3 vTerrainWorldPos;`),e.vertexShader=e.vertexShader.replace("#include <worldpos_vertex>",`#include <worldpos_vertex>
vTerrainWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;`)),e.fragmentShader=`
uniform sampler2D albedo0;
uniform sampler2D albedo1;
uniform sampler2D albedo2;
uniform sampler2D albedo3;
uniform sampler2D albedo4;
uniform sampler2D albedo5;
uniform sampler2D mask0;
uniform sampler2D mask1;
uniform sampler2D mask2;
uniform sampler2D mask3;
uniform sampler2D mask4;
uniform sampler2D mask5;
uniform float tiling0;
uniform float tiling1;
uniform float tiling2;
uniform float tiling3;
uniform float tiling4;
uniform float tiling5;
${n?"uniform sampler2D visibilityMask;":""}
${o?"uniform sampler2D terrainLightmap;":""}
uniform bool sunLightPointsDown;
${a?`uniform sampler2D detailTexture;
uniform float detailTiling;
uniform float detailFadeDistance;
varying vec3 vTerrainWorldPos;`:""}
${eF}
// Global variable to store shadow factor from RE_Direct for use in output calculation
float terrainShadowFactor = 1.0;
`+e.fragmentShader,n){let t="#include <clipping_planes_fragment>";e.fragmentShader=e.fragmentShader.replace(t,`${t}
// Early discard for invisible areas (before fog/lighting)
float visibility = texture2D(visibilityMask, vMapUv).r;
if (visibility < 0.5) {
discard;
}
`)}e.fragmentShader=e.fragmentShader.replace("#include <map_fragment>",`
// Sample base albedo layers (sRGB textures auto-decoded to linear by Three.js)
vec2 baseUv = vMapUv;
vec3 c0 = texture2D(albedo0, baseUv * vec2(tiling0)).rgb;
${s>1?"vec3 c1 = texture2D(albedo1, baseUv * vec2(tiling1)).rgb;":""}
${s>2?"vec3 c2 = texture2D(albedo2, baseUv * vec2(tiling2)).rgb;":""}
${s>3?"vec3 c3 = texture2D(albedo3, baseUv * vec2(tiling3)).rgb;":""}
${s>4?"vec3 c4 = texture2D(albedo4, baseUv * vec2(tiling4)).rgb;":""}
${s>5?"vec3 c5 = texture2D(albedo5, baseUv * vec2(tiling5)).rgb;":""}
// Sample alpha masks for all layers (use R channel)
// Add +0.5 texel offset: Torque samples alpha at grid corners (integer indices),
// but GPU linear filtering samples at texel centers. This offset aligns them.
vec2 alphaUv = baseUv + vec2(0.5 / 256.0);
float a0 = texture2D(mask0, alphaUv).r;
${s>1?"float a1 = texture2D(mask1, alphaUv).r;":""}
${s>2?"float a2 = texture2D(mask2, alphaUv).r;":""}
${s>3?"float a3 = texture2D(mask3, alphaUv).r;":""}
${s>4?"float a4 = texture2D(mask4, alphaUv).r;":""}
${s>5?"float a5 = texture2D(mask5, alphaUv).r;":""}
// Torque-style additive weighted blending (blender.cc):
// result = tex0 * alpha0 + tex1 * alpha1 + tex2 * alpha2 + ...
// Each layer's alpha map defines its contribution weight.
vec3 blended = c0 * a0;
${s>1?"blended += c1 * a1;":""}
${s>2?"blended += c2 * a2;":""}
${s>3?"blended += c3 * a3;":""}
${s>4?"blended += c4 * a4;":""}
${s>5?"blended += c5 * a5;":""}
// Assign to diffuseColor before lighting
vec3 textureColor = blended;
${a?`// Detail texture blending (Torque-style multiplicative blend)
// Sample detail texture at high frequency tiling
vec3 detailColor = texture2D(detailTexture, baseUv * detailTiling).rgb;
// Calculate distance-based fade factor using world positions
// Torque: distFactor = (zeroDetailDistance - distance) / zeroDetailDistance
float distToCamera = distance(vTerrainWorldPos, cameraPosition);
float detailFade = clamp(1.0 - distToCamera / detailFadeDistance, 0.0, 1.0);
// Torque blending: dst * lerp(1.0, detailTexel, fadeFactor)
// Detail textures are authored with bright values (~0.8 mean), not 0.5 gray
// Direct multiplication adds subtle darkening for surface detail
textureColor *= mix(vec3(1.0), detailColor, detailFade);`:""}
// Store blended texture in diffuseColor (still in linear space here)
// We'll convert to sRGB in the output calculation
diffuseColor.rgb = textureColor;
`),o&&(e.fragmentShader=e.fragmentShader.replace("#include <lights_lambert_pars_fragment>",`#include <lights_lambert_pars_fragment>
// Override RE_Direct to extract shadow factor for Torque-style gamma-space lighting
#undef RE_Direct
void RE_Direct_TerrainShadow( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
// Torque lighting (terrLighting.cc): if light points up, terrain gets only ambient
// This prevents shadow acne from light hitting terrain backfaces
if (!sunLightPointsDown) {
terrainShadowFactor = 0.0;
return;
}
// directLight.color = sunColor * shadowFactor (shadow already applied by Three.js)
// Extract shadow factor by comparing to original sun color
#if ( NUM_DIR_LIGHTS > 0 )
vec3 originalSunColor = directionalLights[0].color;
float sunMax = max(max(originalSunColor.r, originalSunColor.g), originalSunColor.b);
float shadowedMax = max(max(directLight.color.r, directLight.color.g), directLight.color.b);
terrainShadowFactor = clamp(shadowedMax / max(sunMax, 0.001), 0.0, 1.0);
#endif
// Don't add to reflectedLight - we'll compute lighting in gamma space at output
}
#define RE_Direct RE_Direct_TerrainShadow
`),e.fragmentShader=e.fragmentShader.replace("#include <lights_fragment_begin>",`#include <lights_fragment_begin>
// Clear indirect diffuse - we'll compute ambient in gamma space
#if defined( RE_IndirectDiffuse )
irradiance = vec3(0.0);
#endif
`),e.fragmentShader=e.fragmentShader.replace("#include <lights_fragment_end>",`#include <lights_fragment_end>
// Clear Three.js lighting - we compute everything in gamma space
reflectedLight.directDiffuse = vec3(0.0);
reflectedLight.indirectDiffuse = vec3(0.0);
`)),e.fragmentShader=e.fragmentShader.replace("#include <opaque_fragment>",`// Torque-style terrain lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space
{
// Get texture in sRGB space (undo Three.js linear decode)
vec3 textureSRGB = terrainLinearToSRGB(diffuseColor.rgb);
${o?`
// Sample terrain lightmap for smooth NdotL
vec2 lightmapUv = vMapUv + vec2(0.5 / 512.0);
float lightmapNdotL = texture2D(terrainLightmap, lightmapUv).r;
// Get sun and ambient colors from Three.js lights (these ARE sRGB values from mission file)
// Three.js interprets them as linear, but the numerical values are preserved
#if ( NUM_DIR_LIGHTS > 0 )
vec3 sunColorSRGB = directionalLights[0].color;
#else
vec3 sunColorSRGB = vec3(0.7);
#endif
vec3 ambientColorSRGB = ambientLightColor;
// Torque formula (terrLighting.cc:471-483):
// lighting = ambient + NdotL * shadowFactor * sunColor
// Clamp lighting to [0,1] before multiplying by texture
vec3 lightingSRGB = clamp(ambientColorSRGB + lightmapNdotL * terrainShadowFactor * sunColorSRGB, 0.0, 1.0);
`:`
// No lightmap - use simple ambient lighting
vec3 lightingSRGB = ambientLightColor;
`}
// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space
vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0);
// Convert back to linear for Three.js output pipeline
outgoingLight = terrainSRGBToLinear(resultSRGB) + totalEmissiveRadiance;
}
#include <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`#if DEBUG_MODE
// Debug mode: overlay green grid matching terrain grid squares (256x256)
float gridIntensity = terrainDebugGrid(vMapUv, 256.0, 1.5);
vec3 gridColor = vec3(0.0, 0.8, 0.4); // Green
gl_FragColor.rgb = mix(gl_FragColor.rgb, gridColor, gridIntensity * 0.1);
#endif
#include <tonemapping_fragment>`)}({shader:e,baseTextures:s,alphaTextures:n,visibilityMask:t,tiling:ew,detailTexture:l?u:null,lightmap:a}),(0,eT.injectCustomFog)(e,eR.globalFogUniforms)},[s,n,t,u,l,a]),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!o,e.needsUpdate=!0)},[o]);let m=`${l?"detail":"nodetail"}-${a?"lightmap":"nolightmap"}`;return(0,d.jsx)("meshLambertMaterial",{ref:f,map:e,depthWrite:!0,side:A.FrontSide,defines:{DEBUG_MODE:+!!o},onBeforeCompile:c},m)}function eI(e){let t,r,n=(0,f.c)(8),{displacementMap:i,visibilityMask:a,textureNames:o,alphaTextures:s,detailTextureName:l,lightmap:u}=e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),n[0]=t):t=n[0],n[1]!==s||n[2]!==l||n[3]!==i||n[4]!==u||n[5]!==o||n[6]!==a?(r=(0,d.jsx)(h.Suspense,{fallback:t,children:(0,d.jsx)(eD,{displacementMap:i,visibilityMask:a,textureNames:o,alphaTextures:s,detailTextureName:l,lightmap:u})}),n[1]=s,n[2]=l,n[3]=i,n[4]=u,n[5]=o,n[6]=a,n[7]=r):r=n[7],r}let eG=(0,h.memo)(function(e){let t,r,n,i=(0,f.c)(15),{tileX:a,tileZ:o,blockSize:s,basePosition:l,textureNames:u,geometry:c,displacementMap:h,visibilityMask:m,alphaTextures:p,detailTextureName:A,lightmap:g,visible:v}=e,C=void 0===v||v,B=s/2,y=l.x+a*s+B,b=l.z+o*s+B;i[0]!==y||i[1]!==b?(t=[y,0,b],i[0]=y,i[1]=b,i[2]=t):t=i[2];let x=t;return i[3]!==p||i[4]!==A||i[5]!==h||i[6]!==g||i[7]!==u||i[8]!==m?(r=(0,d.jsx)(eI,{displacementMap:h,visibilityMask:m,textureNames:u,alphaTextures:p,detailTextureName:A,lightmap:g}),i[3]=p,i[4]=A,i[5]=h,i[6]=g,i[7]=u,i[8]=m,i[9]=r):r=i[9],i[10]!==c||i[11]!==x||i[12]!==r||i[13]!==C?(n=(0,d.jsx)("mesh",{position:x,geometry:c,castShadow:!0,receiveShadow:!0,visible:C,children:r}),i[10]=c,i[11]=x,i[12]=r,i[13]=C,i[14]=n):n=i[14],n});var eL=e.i(77482);function eO(e){let t,r=(0,f.c)(3),n=(0,eL.useRuntime)();return r[0]!==e||r[1]!==n?(t=n.getObjectByName(e),r[0]=e,r[1]=n,r[2]=t):t=r[2],t}function e_(e){let t=new Uint8Array(65536);for(let r of(t.fill(255),e)){let e=255&r,n=r>>8&255,i=r>>16,a=256*n;for(let r=0;r<i;r++){let n=a+e+r;n<t.length&&(t[n]=0)}}let r=new A.DataTexture(t,256,256,A.RedFormat,A.UnsignedByteType);return r.colorSpace=A.NoColorSpace,r.wrapS=r.wrapT=A.ClampToEdgeWrapping,r.magFilter=A.NearestFilter,r.minFilter=A.NearestFilter,r.needsUpdate=!0,r}let eP=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u,c,m,p,g,v,C,B,y,b,x,E,S,F=(0,f.c)(69),{object:M}=e;F[0]!==M?(t=(0,eb.getProperty)(M,"terrainFile"),F[0]=M,F[1]=t):t=F[1];let T=t;F[2]!==M?(r=(0,eb.getInt)(M,"squareSize")??8,F[2]=M,F[3]=r):r=F[3];let R=r;F[4]!==M?(n=(0,eb.getProperty)(M,"detailTexture"),F[4]=M,F[5]=n):n=F[5];let w=n,D=256*R,I=function(){let e,t=(0,f.c)(2),r=eO("Sky");if(!r)return 600;let n=(0,eb.getFloat)(r,"high_visibleDistance");return null!=n&&n>0?n:(t[0]!==r?(e=(0,eb.getFloat)(r,"visibleDistance")??600,t[0]=r,t[1]=e):e=t[1],e)}(),G=(0,ey.useThree)(eH),L=-(128*R);F[6]!==L?(i={x:L,z:L},F[6]=L,F[7]=i):i=F[7];let O=i;if(F[8]!==M){let e=(0,eb.getProperty)(M,"emptySquares");a=e?e.split(" ").map(ek):[],F[8]=M,F[9]=a}else a=F[9];let _=a,{data:P}=((S=(0,f.c)(2))[0]!==T?(E={queryKey:["terrain",T],queryFn:()=>(0,eC.loadTerrain)(T)},S[0]=T,S[1]=E):E=S[1],eg(E,eo,void 0));e:{let e;if(!P){o=null;break e}let t=256*R;F[10]!==t||F[11]!==R||F[12]!==P.heightMap?(!function(e,t,r){let n=e.attributes.position,i=e.attributes.uv,a=e.attributes.normal,o=n.array,s=i.array,l=a.array,u=n.count,c=(e,r)=>(e=Math.max(0,Math.min(255,e)),t[256*(r=Math.max(0,Math.min(255,r)))+e]/65535*2048),d=(e,r)=>{let n=Math.floor(e=Math.max(0,Math.min(255,e))),i=Math.floor(r=Math.max(0,Math.min(255,r))),a=Math.min(n+1,255),o=Math.min(i+1,255),s=e-n,l=r-i;return(t[256*i+n]/65535*2048*(1-s)+t[256*i+a]/65535*2048*s)*(1-l)+(t[256*o+n]/65535*2048*(1-s)+t[256*o+a]/65535*2048*s)*l};for(let e=0;e<u;e++){let t=s[2*e],n=s[2*e+1],i=c(255&Math.floor(256*t),255&Math.floor(256*n));o[3*e+1]=i;let a=255*t,u=255*n,f=d(a-1,u),h=d(a+1,u),m=(d(a,u+1)-d(a,u-1))/2,p=r,A=(h-f)/2,g=Math.sqrt(m*m+p*p+A*A);g>0?(m/=g,p/=g,A/=g):(m=0,p=1,A=0),l[3*e]=m,l[3*e+1]=p,l[3*e+2]=A}n.needsUpdate=!0,a.needsUpdate=!0}(e=function(e,t){let r=new A.BufferGeometry,n=new Float32Array(198147),i=new Float32Array(198147),a=new Float32Array(132098),o=new Uint32Array(393216),s=0,l=e/256;for(let t=0;t<=256;t++)for(let r=0;r<=256;r++){let o=257*t+r;n[3*o]=r*l-e/2,n[3*o+1]=e/2-t*l,n[3*o+2]=0,i[3*o]=0,i[3*o+1]=0,i[3*o+2]=1,a[2*o]=r/256,a[2*o+1]=1-t/256}for(let e=0;e<256;e++)for(let t=0;t<256;t++){let r=257*e+t,n=r+1,i=(e+1)*257+t,a=i+1;((t^e)&1)==0?(o[s++]=r,o[s++]=i,o[s++]=a,o[s++]=r,o[s++]=a,o[s++]=n):(o[s++]=r,o[s++]=i,o[s++]=n,o[s++]=n,o[s++]=i,o[s++]=a)}return r.setIndex(new A.BufferAttribute(o,1)),r.setAttribute("position",new A.Float32BufferAttribute(n,3)),r.setAttribute("normal",new A.Float32BufferAttribute(i,3)),r.setAttribute("uv",new A.Float32BufferAttribute(a,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(t,0),P.heightMap,R),F[10]=t,F[11]=R,F[12]=P.heightMap,F[13]=e):e=F[13],o=e}let H=o,k=eO("Sun");t:{let e,t;if(!k){let e;F[14]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector3(.57735,-.57735,.57735),F[14]=e):e=F[14],s=e;break t}F[15]!==k?(e=((0,eb.getProperty)(k,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(eU),F[15]=k,F[16]=e):e=F[16];let[r,n,i]=e,a=Math.sqrt(r*r+i*i+n*n),o=r/a,l=i/a,u=n/a;F[17]!==l||F[18]!==u||F[19]!==o?(t=new A.Vector3(o,l,u),F[17]=l,F[18]=u,F[19]=o,F[20]=t):t=F[20],s=t}let U=s;r:{let e;if(!P){l=null;break r}F[21]!==R||F[22]!==U||F[23]!==P.heightMap?(e=function(e,t,r){let n=(t,r)=>{let n=Math.max(0,Math.min(255,t)),i=Math.max(0,Math.min(255,r)),a=Math.floor(n),o=Math.floor(i),s=Math.min(a+1,255),l=Math.min(o+1,255),u=n-a,c=i-o;return((e[256*o+a]/65535*(1-u)+e[256*o+s]/65535*u)*(1-c)+(e[256*l+a]/65535*(1-u)+e[256*l+s]/65535*u)*c)*2048},i=new A.Vector3(-t.x,-t.y,-t.z).normalize(),a=new Uint8Array(262144);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let o=t/2+.25,s=e/2+.25,l=n(o,s),u=n(o-.5,s),c=n(o+.5,s),d=n(o,s-.5),f=-((n(o,s+.5)-d)/1),h=-((c-u)/1),m=Math.sqrt(f*f+r*r+h*h),p=Math.max(0,f/m*i.x+r/m*i.y+h/m*i.z),A=1;p>0&&(A=function(e,t,r,n,i,a){let o=n.z/i,s=n.x/i,l=n.y,u=Math.sqrt(o*o+s*s);if(u<1e-4)return 1;let c=.5/u,d=o*c,f=s*c,h=l*c,m=e,p=t,A=r+.1;for(let e=0;e<768&&(m+=d,p+=f,A+=h,!(m<0)&&!(m>=256)&&!(p<0)&&!(p>=256)&&!(A>2048));e++)if(A<a(m,p))return 0;return 1}(o,s,l,i,r,n)),a[512*e+t]=Math.floor(p*A*255)}let o=new A.DataTexture(a,512,512,A.RedFormat,A.UnsignedByteType);return o.colorSpace=A.NoColorSpace,o.generateMipmaps=!0,o.wrapS=A.ClampToEdgeWrapping,o.wrapT=A.ClampToEdgeWrapping,o.magFilter=A.LinearFilter,o.minFilter=A.LinearFilter,o.needsUpdate=!0,o}(P.heightMap,U,R),F[21]=R,F[22]=U,F[23]=P.heightMap,F[24]=e):e=F[24],l=e}let j=l;n:{let e;if(!P){u=null;break n}if(F[25]!==P.heightMap){let t=function(e){let t=new Float32Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(P.heightMap);(e=new A.DataTexture(t,256,256,A.RedFormat,A.FloatType)).colorSpace=A.NoColorSpace,e.generateMipmaps=!1,e.wrapS=A.RepeatWrapping,e.wrapT=A.RepeatWrapping,e.needsUpdate=!0,F[25]=P.heightMap,F[26]=e}else e=F[26];u=e}let N=u;F[27]!==_?(c=e_(_),F[27]=_,F[28]=c):c=F[28];let J=c;F[29]===Symbol.for("react.memo_cache_sentinel")?(m=e_([]),F[29]=m):m=F[29];let K=m;i:{let e;if(!P){p=null;break i}F[30]!==P.alphaMaps?(e=P.alphaMaps.map(ej),F[30]=P.alphaMaps,F[31]=e):e=F[31],p=e}let Q=p,V=2*Math.ceil(I/D)+1,q=V*V-1;F[32]!==q?(g=Array.from({length:q},eN),F[32]=q,F[33]=g):g=F[33];let X=g;F[34]!==q?(v=()=>Array(q).fill(null),F[34]=q,F[35]=v):v=F[35];let[W,Y]=(0,h.useState)(v);F[36]===Symbol.for("react.memo_cache_sentinel")?(C={xStart:0,xEnd:0,zStart:0,zEnd:0},F[36]=C):C=F[36];let z=(0,h.useRef)(C);return(F[37]!==O.x||F[38]!==O.z||F[39]!==D||F[40]!==G.position.x||F[41]!==G.position.z||F[42]!==q||F[43]!==I?(B=()=>{let e=G.position.x-O.x,t=G.position.z-O.z,r=Math.floor((e-I)/D),n=Math.ceil((e+I)/D),i=Math.floor((t-I)/D),a=Math.ceil((t+I)/D),o=z.current;if(r===o.xStart&&n===o.xEnd&&i===o.zStart&&a===o.zEnd)return;o.xStart=r,o.xEnd=n,o.zStart=i,o.zEnd=a;let s=[];for(let e=r;e<n;e++)for(let t=i;t<a;t++)(0!==e||0!==t)&&s.push({tileX:e,tileZ:t});for(;s.length<q;)s.push(null);Y(s)},F[37]=O.x,F[38]=O.z,F[39]=D,F[40]=G.position.x,F[41]=G.position.z,F[42]=q,F[43]=I,F[44]=B):B=F[44],(0,eB.useFrame)(B),P&&H&&N&&Q)?(F[45]!==O||F[46]!==D||F[47]!==w||F[48]!==J||F[49]!==Q||F[50]!==N||F[51]!==H||F[52]!==P.textureNames||F[53]!==j?(y=(0,d.jsx)(eG,{tileX:0,tileZ:0,blockSize:D,basePosition:O,textureNames:P.textureNames,geometry:H,displacementMap:N,visibilityMask:J,alphaTextures:Q,detailTextureName:w,lightmap:j}),F[45]=O,F[46]=D,F[47]=w,F[48]=J,F[49]=Q,F[50]=N,F[51]=H,F[52]=P.textureNames,F[53]=j,F[54]=y):y=F[54],F[55]!==O||F[56]!==D||F[57]!==w||F[58]!==X||F[59]!==Q||F[60]!==N||F[61]!==H||F[62]!==P.textureNames||F[63]!==j||F[64]!==W?(b=X.map(e=>{let t=W[e];return(0,d.jsx)(eG,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:D,basePosition:O,textureNames:P.textureNames,geometry:H,displacementMap:N,visibilityMask:K,alphaTextures:Q,detailTextureName:w,lightmap:j,visible:null!==t},e)}),F[55]=O,F[56]=D,F[57]=w,F[58]=X,F[59]=Q,F[60]=N,F[61]=H,F[62]=P.textureNames,F[63]=j,F[64]=W,F[65]=b):b=F[65],F[66]!==y||F[67]!==b?(x=(0,d.jsxs)(d.Fragment,{children:[y,b]}),F[66]=y,F[67]=b,F[68]=x):x=F[68],x):null});function eH(e){return e.camera}function ek(e){return parseInt(e,10)}function eU(e){return parseFloat(e)}function ej(e){return(0,ex.setupMask)(e)}function eN(e,t){return t}let eJ=(0,h.createContext)(null);function eK(){return(0,h.useContext)(eJ)}function eQ(e,t){return(0,d.jsx)(rj,{object:e},e._id)}var eV=h;let eq=(0,eV.createContext)(null),eX={didCatch:!1,error:null};class eW extends eV.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=eX}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(eX))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;r&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(this.props.onReset?.({next:n,prev:e.resetKeys,reason:"keys"}),this.setState(eX))}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(r)o=(0,eV.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,eV.createElement)(eq.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}var eY=e.i(31067),ez=A;function eZ(e,t){if(t===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==A.TriangleFanDrawMode&&t!==A.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<n.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}let n=r.count-2,i=[];if(r)if(t===A.TriangleFanDrawMode)for(let e=1;e<=n;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(i),a.clearGroups(),a}}let e$=parseInt(A.REVISION.replace(/\D+/g,""));function e0(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let e1="srgb",e2="srgb-linear";class e9 extends ez.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new e7(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new tu(e)}),this.register(function(e){return new tc(e)}),this.register(function(e){return new td(e)}),this.register(function(e){return new tr(e)}),this.register(function(e){return new tn(e)}),this.register(function(e){return new ti(e)}),this.register(function(e){return new ta(e)}),this.register(function(e){return new e6(e)}),this.register(function(e){return new to(e)}),this.register(function(e){return new tt(e)}),this.register(function(e){return new tl(e)}),this.register(function(e){return new ts(e)}),this.register(function(e){return new e8(e)}),this.register(function(e){return new tf(e)}),this.register(function(e){return new th(e)})}load(e,t,r,n){let i,a=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){let t=ez.LoaderUtils.extractUrlBase(e);i=ez.LoaderUtils.resolveURL(t,this.path)}else i=ez.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){n?n(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new ez.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(r){try{a.parse(r,i,function(r){t(r),a.manager.itemEnd(e)},o)}catch(e){o(e)}},r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){let i,a={},o={};if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(e0(new Uint8Array(e.slice(0,4)))===tm){try{a[e5.KHR_BINARY_GLTF]=new tp(e)}catch(e){n&&n(e);return}i=JSON.parse(a[e5.KHR_BINARY_GLTF].content)}else i=JSON.parse(e0(new Uint8Array(e)));else i=e;if(void 0===i.asset||i.asset.version[0]<2){n&&n(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let s=new tO(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](s);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],r=i.extensionsRequired||[];switch(t){case e5.KHR_MATERIALS_UNLIT:a[t]=new e4;break;case e5.KHR_DRACO_MESH_COMPRESSION:a[t]=new tA(i,this.dracoLoader);break;case e5.KHR_TEXTURE_TRANSFORM:a[t]=new tg;break;case e5.KHR_MESH_QUANTIZATION:a[t]=new tv;break;default:r.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}s.setExtensions(a),s.setPlugins(o),s.parse(r,n)}parseAsync(e,t){let r=this;return new Promise(function(n,i){r.parse(e,t,n,i)})}}function e3(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let e5={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class e8{constructor(e){this.parser=e,this.name=e5.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r<n;r++){let n=t[r];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(e){let t,r=this.parser,n="light:"+e,i=r.cache.get(n);if(i)return i;let a=r.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new ez.Color(0xffffff);void 0!==o.color&&s.setRGB(o.color[0],o.color[1],o.color[2],e2);let l=void 0!==o.range?o.range:0;switch(o.type){case"directional":(t=new ez.DirectionalLight(s)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new ez.PointLight(s)).distance=l;break;case"spot":(t=new ez.SpotLight(s)).distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,t.angle=o.spot.outerConeAngle,t.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return t.position.set(0,0,0),t.decay=2,tD(t,o),void 0!==o.intensity&&(t.intensity=o.intensity),t.name=r.createUniqueName(o.name||"light_"+e),i=Promise.resolve(t),r.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,r=this.parser,n=r.json.nodes[e],i=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then(function(e){return r._getNodeRef(t.cache,i,e)})}}class e4{constructor(){this.name=e5.KHR_MATERIALS_UNLIT}getMaterialType(){return ez.MeshBasicMaterial}extendParams(e,t,r){let n=[];e.color=new ez.Color(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],e2),e.opacity=t[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(e,"map",i.baseColorTexture,e1))}return Promise.all(n)}}class e6{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=r.extensions[this.name].emissiveStrength;return void 0!==n&&(t.emissiveIntensity=n),Promise.resolve()}}class e7{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&i.push(r.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&i.push(r.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(i.push(r.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ez.Vector2(e,e)}return Promise.all(i)}}class te{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=r.extensions[this.name];return t.dispersion=void 0!==n.dispersion?n.dispersion:0,Promise.resolve()}}class tt{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&i.push(r.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&i.push(r.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(i)}}class tr{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[];t.sheenColor=new ez.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=n.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],e2)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&i.push(r.assignTexture(t,"sheenColorMap",a.sheenColorTexture,e1)),void 0!==a.sheenRoughnessTexture&&i.push(r.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(i)}}class tn{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&i.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(i)}}class ti{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&i.push(r.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let o=a.attenuationColor||[1,1,1];return t.attenuationColor=new ez.Color().setRGB(o[0],o[1],o[2],e2),Promise.all(i)}}class ta{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=r.extensions[this.name];return t.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}}class to{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&i.push(r.assignTexture(t,"specularIntensityMap",a.specularTexture));let o=a.specularColorFactor||[1,1,1];return t.specularColor=new ez.Color().setRGB(o[0],o[1],o[2],e2),void 0!==a.specularColorTexture&&i.push(r.assignTexture(t,"specularColorMap",a.specularColorTexture,e1)),Promise.all(i)}}class ts{constructor(e){this.parser=e,this.name=e5.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&i.push(r.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(i)}}class tl{constructor(e){this.parser=e,this.name=e5.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?ez.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=[],a=n.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&i.push(r.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(i)}}class tu{constructor(e){this.parser=e,this.name=e5.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,r=t.json,n=r.textures[e];if(!n.extensions||!n.extensions[this.name])return null;let i=n.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,a)}}class tc{constructor(e){this.parser=e,this.name=e5.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class td{constructor(e){this.parser=e,this.name=e5.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,n=r.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=n.images[a.source],s=r.textureLoader;if(o.uri){let e=r.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class tf{constructor(e){this.name=e5.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let r=e.byteOffset||0,n=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,r,n);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}}}class th{constructor(e){this.name=e5.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==tb.TRIANGLES&&e.mode!==tb.TRIANGLE_STRIP&&e.mode!==tb.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=r.extensions[this.name].attributes,i=[],a={};for(let e in n)i.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],n=e[0].count,i=[];for(let e of r){let t=new ez.Matrix4,r=new ez.Vector3,o=new ez.Quaternion,s=new ez.Vector3(1,1,1),l=new ez.InstancedMesh(e.geometry,e.material,n);for(let e=0;e<n;e++)a.TRANSLATION&&r.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&o.fromBufferAttribute(a.ROTATION,e),a.SCALE&&s.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(r,o,s));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new ez.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);ez.Object3D.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),i.push(l)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}}let tm="glTF";class tp{constructor(e){this.name=e5.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:e0(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==tm)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,n=new DataView(e,12);let i=0;for(;i<r;){const t=n.getUint32(i,!0);i+=4;const r=n.getUint32(i,!0);if(i+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+i,t);this.content=e0(r)}else if(5130562===r){const r=12+i;this.body=e.slice(r,r+t)}i+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class tA{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=e5.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let r=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(let e in a)o[tM[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let n=tM[t]||t.toLowerCase();if(void 0!==a[t]){let i=r.accessors[e.attributes[t]],a=tx[i.componentType];l[n]=a.name,s[n]=!0===i.normalized}}return t.getDependency("bufferView",i).then(function(e){return new Promise(function(t,r){n.decodeDracoFile(e,function(e){for(let t in e.attributes){let r=e.attributes[t],n=s[t];void 0!==n&&(r.normalized=n)}t(e)},o,l,e2,r)})})}}class tg{constructor(){this.name=e5.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class tv{constructor(){this.name=e5.KHR_MESH_QUANTIZATION}}class tC extends ez.Interpolant{constructor(e,t,r,n){super(e,t,r,n)}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let e=0;e!==n;e++)t[e]=r[i+e];return t}interpolate_(e,t,r,n){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=n-t,c=(r-t)/u,d=c*c,f=d*c,h=e*l,m=h-l,p=-2*f+3*d,A=f-d,g=1-p,v=A-d+c;for(let e=0;e!==o;e++){let t=a[m+e+o],r=a[m+e+s]*u,n=a[h+e+o],l=a[h+e]*u;i[e]=g*t+v*r+p*n+A*l}return i}}let tB=new ez.Quaternion;class ty extends tC{interpolate_(e,t,r,n){let i=super.interpolate_(e,t,r,n);return tB.fromArray(i).normalize().toArray(i),i}}let tb={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},tx={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tE={9728:ez.NearestFilter,9729:ez.LinearFilter,9984:ez.NearestMipmapNearestFilter,9985:ez.LinearMipmapNearestFilter,9986:ez.NearestMipmapLinearFilter,9987:ez.LinearMipmapLinearFilter},tS={33071:ez.ClampToEdgeWrapping,33648:ez.MirroredRepeatWrapping,10497:ez.RepeatWrapping},tF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tM={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...e$>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},tT={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tR={CUBICSPLINE:void 0,LINEAR:ez.InterpolateLinear,STEP:ez.InterpolateDiscrete};function tw(e,t,r){for(let n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function tD(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function tI(e){let t="",r=Object.keys(e).sort();for(let n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function tG(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let tL=new ez.Matrix4;class tO{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new e3,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,n=!1,i=-1;"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=(n=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||n&&i<98?this.textureLoader=new ez.TextureLoader(this.options.manager):this.textureLoader=new ez.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ez.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};return tw(i,a,n),tD(a,n),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,n=t.length;r<n;r++){let n=t[r].joints;for(let t=0,r=n.length;t<r;t++)e[n[t]].isBone=!0}for(let t=0,n=e.length;t<n;t++){let n=e[t];void 0!==n.mesh&&(this._addNodeRef(this.meshCache,n.mesh),void 0!==n.skin&&(r[n.mesh].isSkinnedMesh=!0)),void 0!==n.camera&&this._addNodeRef(this.cameraCache,n.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;let n=r.clone(),i=(e,t)=>{let r=this.associations.get(e);for(let[n,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))i(a,t.children[n])};return i(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){let n=e(t[r]);if(n)return n}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let r=[];for(let n=0;n<t.length;n++){let i=e(t[n]);i&&r.push(i)}return r}getDependency(e,t){let r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":n=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(!(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(r,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){let r=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,n){return r.getDependency(e,n)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[e5.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(e,i){r.load(ez.LoaderUtils.resolveURL(t.uri,n.path),e,void 0,function(){i(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)})}loadAccessor(e){let t=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){let e=tF[n.type],t=tx[n.componentType],r=!0===n.normalized,i=new t(n.count*e);return Promise.resolve(new ez.BufferAttribute(i,e,r))}let i=[];return void 0!==n.bufferView?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),void 0!==n.sparse&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(e){let i,a,o=e[0],s=tF[n.type],l=tx[n.componentType],u=l.BYTES_PER_ELEMENT,c=u*s,d=n.byteOffset||0,f=void 0!==n.bufferView?r.bufferViews[n.bufferView].byteStride:void 0,h=!0===n.normalized;if(f&&f!==c){let e=Math.floor(d/f),r="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count,c=t.cache.get(r);c||(i=new l(o,e*f,n.count*f/u),c=new ez.InterleavedBuffer(i,f/u),t.cache.add(r,c)),a=new ez.InterleavedBufferAttribute(c,s,d%f/u,h)}else i=null===o?new l(n.count*s):new l(o,d,n.count*s),a=new ez.BufferAttribute(i,s,h);if(void 0!==n.sparse){let t=tF.SCALAR,r=tx[n.sparse.indices.componentType],i=n.sparse.indices.byteOffset||0,u=n.sparse.values.byteOffset||0,c=new r(e[1],i,n.sparse.count*t),d=new l(e[2],u,n.sparse.count*s);null!==o&&(a=new ez.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(let e=0,t=c.length;e<t;e++){let t=c[e];if(a.setX(t,d[e*s]),s>=2&&a.setY(t,d[e*s+1]),s>=3&&a.setZ(t,d[e*s+2]),s>=4&&a.setW(t,d[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,n=t.textures[e].source,i=t.images[n],a=this.textureLoader;if(i.uri){let e=r.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){let n=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);let r=(i.samplers||{})[a.sampler]||{};return t.magFilter=tE[r.magFilter]||ez.LinearFilter,t.minFilter=tE[r.minFilter]||ez.LinearMipmapLinearFilter,t.wrapS=tS[r.wrapS]||ez.RepeatWrapping,t.wrapT=tS[r.wrapT]||ez.RepeatWrapping,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){let r=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=r.images[e],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){s=!0;let t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(e){return new Promise(function(r,i){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new ez.Texture(e);t.needsUpdate=!0,r(t)}),t.load(ez.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),tD(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){let i=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),i.extensions[e5.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[e5.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[e5.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?e1:e2),"colorSpace"in a?a.colorSpace=n:a.encoding=n===e1?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,n=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new ez.PointsMaterial,ez.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new ez.LineBasicMaterial,ez.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(n||i||a){let e="ClonedMaterial:"+r.uuid+":";n&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return ez.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},s=a.extensions||{},l=[];if(s[e5.KHR_MATERIALS_UNLIT]){let e=i[e5.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new ez.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],e2),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(o,"map",n.baseColorTexture,e1)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),l.push(r.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=ez.DoubleSide);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==ez.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new ez.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==ez.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==ez.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new ez.Color().setRGB(e[0],e[1],e[2],e2)}return void 0!==a.emissiveTexture&&t!==ez.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,e1)),Promise.all(l).then(function(){let n=new t(o);return a.name&&(n.name=a.name),tD(n,a),r.associations.set(n,{materials:e}),a.extensions&&tw(i,n,a),n})}createUniqueName(e){let t=ez.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,n=this.primitiveCache,i=[];for(let a=0,o=e.length;a<o;a++){let o=e[a],s=function(e){let t,r=e.extensions&&e.extensions[e5.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+tI(r.attributes):e.indices+":"+tI(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,n=e.targets.length;r<n;r++)t+=":"+tI(e.targets[r]);return t}(o),l=n[s];if(l)i.push(l.promise);else{let e;e=o.extensions&&o.extensions[e5.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[e5.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return t_(r,e,t)})}(o):t_(new ez.BufferGeometry,o,t),n[s]={primitive:o,promise:e},i.push(e)}}return Promise.all(i)}loadMesh(e){let t=this,r=this.json,n=this.extensions,i=r.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){var s;let t=void 0===a[e].material?(void 0===(s=this.cache).DefaultMaterial&&(s.DefaultMaterial=new ez.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ez.FrontSide})),s.DefaultMaterial):this.getDependency("material",a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(r){let o=r.slice(0,r.length-1),s=r[r.length-1],l=[];for(let r=0,u=s.length;r<u;r++){let u,c=s[r],d=a[r],f=o[r];if(d.mode===tb.TRIANGLES||d.mode===tb.TRIANGLE_STRIP||d.mode===tb.TRIANGLE_FAN||void 0===d.mode)!0===(u=!0===i.isSkinnedMesh?new ez.SkinnedMesh(c,f):new ez.Mesh(c,f)).isSkinnedMesh&&u.normalizeSkinWeights(),d.mode===tb.TRIANGLE_STRIP?u.geometry=eZ(u.geometry,ez.TriangleStripDrawMode):d.mode===tb.TRIANGLE_FAN&&(u.geometry=eZ(u.geometry,ez.TriangleFanDrawMode));else if(d.mode===tb.LINES)u=new ez.LineSegments(c,f);else if(d.mode===tb.LINE_STRIP)u=new ez.Line(c,f);else if(d.mode===tb.LINE_LOOP)u=new ez.LineLoop(c,f);else if(d.mode===tb.POINTS)u=new ez.Points(c,f);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);Object.keys(u.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,n=t.weights.length;r<n;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){let r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,n=r.length;t<n;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(u,i),u.name=t.createUniqueName(i.name||"mesh_"+e),tD(u,i),d.extensions&&tw(n,u,d),t.assignFinalMaterial(u),l.push(u)}for(let r=0,n=l.length;r<n;r++)t.associations.set(l[r],{meshes:e,primitives:r});if(1===l.length)return i.extensions&&tw(n,l[0],i),l[0];let u=new ez.Group;i.extensions&&tw(n,u,i),t.associations.set(u,{meshes:e});for(let e=0,t=l.length;e<t;e++)u.add(l[e]);return u})}loadCamera(e){let t,r=this.json.cameras[e],n=r[r.type];return n?("perspective"===r.type?t=new ez.PerspectiveCamera(ez.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(t=new ez.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),tD(t,r),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],r=[];for(let e=0,n=t.joints.length;e<n;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){let r=e.pop(),n=[],i=[];for(let a=0,o=e.length;a<o;a++){let o=e[a];if(o){n.push(o);let e=new ez.Matrix4;null!==r&&e.fromArray(r.array,16*a),i.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new ez.Skeleton(n,i)})}loadAnimation(e){let t=this.json,r=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,a=[],o=[],s=[],l=[],u=[];for(let e=0,t=n.channels.length;e<t;e++){let t=n.channels[e],r=n.samplers[t.sampler],i=t.target,c=i.node,d=void 0!==n.parameters?n.parameters[r.input]:r.input,f=void 0!==n.parameters?n.parameters[r.output]:r.output;void 0!==i.node&&(a.push(this.getDependency("node",c)),o.push(this.getDependency("accessor",d)),s.push(this.getDependency("accessor",f)),l.push(r),u.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(u)]).then(function(e){let t=e[0],n=e[1],a=e[2],o=e[3],s=e[4],l=[];for(let e=0,i=t.length;e<i;e++){let i=t[e],u=n[e],c=a[e],d=o[e],f=s[e];if(void 0===i)continue;i.updateMatrix&&i.updateMatrix();let h=r._createAnimationTracks(i,u,c,d,f);if(h)for(let e=0;e<h.length;e++)l.push(h[e])}return new ez.AnimationClip(i,void 0,l)})}createNodeMesh(e){let t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then(function(e){let t=r._getNodeRef(r.meshCache,n.mesh,e);return void 0!==n.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],r=this._loadNodeShallow(e),n=[],i=t.children||[];for(let e=0,t=i.length;e<t;e++)n.push(this.getDependency("node",i[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([r,Promise.all(n),a]).then(function(e){let t=e[0],r=e[1],n=e[2];null!==n&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(n,tL)});for(let e=0,n=r.length;e<n;e++)t.add(r[e]);return t})}_loadNodeShallow(e){let t=this.json,r=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let i=t.nodes[e],a=i.name?n.createUniqueName(i.name):"",o=[],s=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),void 0!==i.camera&&o.push(n.getDependency("camera",i.camera).then(function(e){return n._getNodeRef(n.cameraCache,i.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if((o=!0===i.isBone?new ez.Bone:t.length>1?new ez.Group:1===t.length?t[0]:new ez.Object3D)!==t[0])for(let e=0,r=t.length;e<r;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),tD(o,i),i.extensions&&tw(r,o,i),void 0!==i.matrix){let e=new ez.Matrix4;e.fromArray(i.matrix),o.applyMatrix4(e)}else void 0!==i.translation&&o.position.fromArray(i.translation),void 0!==i.rotation&&o.quaternion.fromArray(i.rotation),void 0!==i.scale&&o.scale.fromArray(i.scale);return n.associations.has(o)||n.associations.set(o,{}),n.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,r=this.json.scenes[e],n=this,i=new ez.Group;r.name&&(i.name=n.createUniqueName(r.name)),tD(i,r),r.extensions&&tw(t,i,r);let a=r.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(n.getDependency("node",a[e]));return Promise.all(o).then(function(e){for(let t=0,r=e.length;t<r;t++)i.add(e[t]);return n.associations=(e=>{let t=new Map;for(let[e,r]of n.associations)(e instanceof ez.Material||e instanceof ez.Texture)&&t.set(e,r);return e.traverse(e=>{let r=n.associations.get(e);null!=r&&t.set(e,r)}),t})(i),i})}_createAnimationTracks(e,t,r,n,i){let a,o=[],s=e.name?e.name:e.uuid,l=[];switch(tT[i.path]===tT.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),tT[i.path]){case tT.weights:a=ez.NumberKeyframeTrack;break;case tT.rotation:a=ez.QuaternionKeyframeTrack;break;case tT.position:case tT.scale:a=ez.VectorKeyframeTrack;break;default:a=1===r.itemSize?ez.NumberKeyframeTrack:ez.VectorKeyframeTrack}let u=void 0!==n.interpolation?tR[n.interpolation]:ez.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e<r;e++){let r=new a(l[e]+"."+tT[i.path],t.array,c,u);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(r),o.push(r)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=tG(t.constructor),r=new Float32Array(t.length);for(let n=0,i=t.length;n<i;n++)r[n]=t[n]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof ez.QuaternionKeyframeTrack?ty:tC)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function t_(e,t,r){let n=t.attributes,i=[];for(let t in n){let a=tM[t]||t.toLowerCase();a in e.attributes||i.push(function(t,n){return r.getDependency("accessor",t).then(function(t){e.setAttribute(n,t)})}(n[t],a))}if(void 0!==t.indices&&!e.index){let n=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(n)}return tD(e,t),!function(e,t,r){let n=t.attributes,i=new ez.Box3;if(void 0===n.POSITION)return;{let e=r.json.accessors[n.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new ez.Vector3(t[0],t[1],t[2]),new ez.Vector3(a[0],a[1],a[2])),e.normalized){let t=tG(tx[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new ez.Vector3,t=new ez.Vector3;for(let n=0,i=a.length;n<i;n++){let i=a[n];if(void 0!==i.POSITION){let n=r.json.accessors[i.POSITION],a=n.min,o=n.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),n.normalized){let e=tG(tx[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;let o=new ez.Sphere;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}(e,t,r),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,r){let n=!1,i=!1,a=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e];if(void 0!==r.POSITION&&(n=!0),void 0!==r.NORMAL&&(i=!0),void 0!==r.COLOR_0&&(a=!0),n&&i&&a)break}if(!n&&!i&&!a)return Promise.resolve(e);let o=[],s=[],l=[];for(let u=0,c=t.length;u<c;u++){let c=t[u];if(n){let t=void 0!==c.POSITION?r.getDependency("accessor",c.POSITION):e.attributes.position;o.push(t)}if(i){let t=void 0!==c.NORMAL?r.getDependency("accessor",c.NORMAL):e.attributes.normal;s.push(t)}if(a){let t=void 0!==c.COLOR_0?r.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){let r=t[0],o=t[1],s=t[2];return n&&(e.morphAttributes.position=r),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,r):e})}var tP=A;let tH=new WeakMap;class tk extends tP.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,n){let i=new tP.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,e=>{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(n)},r,n)}decodeDracoFile(e,t,r,n){let i={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let n=JSON.stringify(t);if(tH.has(e)){let t=tH.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(i,a).then(n=>(r=n,new Promise((n,a)=>{r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&i&&this._releaseTask(r,i)}),tH.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new tP.BufferGeometry;e.index&&t.setIndex(new tP.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let n=e.attributes[r],i=n.name,a=n.array,o=n.itemSize;t.setAttribute(i,new tP.BufferAttribute(a,o))}return t}_loadLibrary(e,t){let r=new tP.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((t,n)=>{r.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=tU.toString(),i=["/* draco decoder */",r,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function tU(){let e,t;onmessage=function(r){let n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let i=n.buffer,a=n.taskConfig;t.then(e=>{let t=e.draco,r=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{let e=function(e,t,r,n){var i,a,o;let s,l,u,c,d,f,h=n.attributeIDs,m=n.attributeTypes,p=t.GetEncodedGeometryType(r);if(p===e.TRIANGULAR_MESH)d=new e.Mesh,f=t.DecodeBufferToMesh(r,d);else if(p===e.POINT_CLOUD)d=new e.PointCloud,f=t.DecodeBufferToPointCloud(r,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let A={index:null,attributes:[]};for(let r in h){let i,a,o=self[m[r]];if(n.useUniqueIDs)a=h[r],i=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[h[r]])))continue;i=t.GetAttribute(d,a)}A.attributes.push(function(e,t,r,n,i,a){let o=a.num_components(),s=r.num_points()*o,l=s*i.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,a,u,l,c);let d=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:n,array:d,itemSize:o}}(e,t,d,r,o,i))}return p===e.TRIANGULAR_MESH&&(i=e,a=t,o=d,s=3*o.num_faces(),l=4*s,u=i._malloc(l),a.GetTrianglesUInt32Array(o,l,u),c=new Uint32Array(i.HEAPF32.buffer,u,s).slice(),i._free(u),A.index={array:c,itemSize:1}),e.destroy(d),A}(t,r,o,a),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},i)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(o),t.destroy(r)}})}}}var tj=e.i(971);let tN=function(e){let t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(let i=0;i<t.children.length;i++)e(t.children[i],r.children[i],n)}(e,n,function(e,n){t.set(n,e),r.set(e,n)}),n.traverse(function(e){if(!e.isSkinnedMesh)return;let n=t.get(e),i=n.skeleton.bones;e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=i.map(function(e){return r.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),n},tJ=h.forwardRef(({isChild:e=!1,object:t,children:r,deep:n,castShadow:i,receiveShadow:a,inject:o,keys:s,...l},u)=>{let c={keys:s,deep:n,inject:o,castShadow:i,receiveShadow:a};if(Array.isArray(t=h.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return tN(t)}return t},[t,e])))return h.createElement("group",(0,eY.default)({},l,{ref:u}),t.map(e=>h.createElement(tJ,(0,eY.default)({key:e.uuid,object:e},c))),r);let{children:d,...f}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:n,castShadow:i,receiveShadow:a}){let o={};for(let r of t)o[r]=e[r];return r&&(o.geometry&&"materialsOnly"!==r&&(o.geometry=o.geometry.clone()),o.material&&"geometriesOnly"!==r&&(o.material=o.material.clone())),n&&(o="function"==typeof n?{...o,children:n(e)}:h.isValidElement(n)?{...o,children:n}:{...o,...n}),e instanceof A.Mesh&&(i&&(o.castShadow=!0),a&&(o.receiveShadow=!0)),o}(t,c),m=t.type[0].toLowerCase()+t.type.slice(1);return h.createElement(m,(0,eY.default)({},f,l,{ref:u}),t.children.map(e=>"Bone"===e.type?h.createElement("primitive",(0,eY.default)({key:e.uuid,object:e},c)):h.createElement(tJ,(0,eY.default)({key:e.uuid,object:e},c,{isChild:!0}))),r,d)}),tK=null,tQ="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function tV(e=!0,r=!0,n){return i=>{n&&n(i),e&&(tK||(tK=new tk),tK.setDecoderPath("string"==typeof e?e:tQ),i.setDRACOLoader(tK)),r&&i.setMeshoptDecoder((()=>{let e;if(t)return t;let r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let i="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";WebAssembly.validate(r)&&(i="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");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);t[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let i=0;i<e.length;++i)t[r++]=t[i]<60?n[t[i]]:(t[i]-60)*64+t[++i];return t.buffer.slice(0,r)}(i),{}).then(t=>{(e=t.instance).exports.__wasm_call_ctors()});function o(t,r,n,i,a,o){let s=e.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,c);let f=t(u,n,i,c,a.length);if(0===f&&o&&o(u,l,i),r.set(d.subarray(u,u+n*i)),s(u-s(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}let s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return t={ready:a,supported:!0,decodeVertexBuffer(t,r,n,i,a){o(e.exports.meshopt_decodeVertexBuffer,t,r,n,i,e.exports[s[a]])},decodeIndexBuffer(t,r,n,i){o(e.exports.meshopt_decodeIndexBuffer,t,r,n,i)},decodeIndexSequence(t,r,n,i){o(e.exports.meshopt_decodeIndexSequence,t,r,n,i)},decodeGltfBuffer(t,r,n,i,a,u){o(e.exports[l[a]],t,r,n,i,e.exports[s[u]])}}})())}}let tq=(e,t,r,n)=>(0,tj.useLoader)(e9,e,tV(t,r,n));tq.preload=(e,t,r,n)=>tj.useLoader.preload(e9,e,tV(t,r,n)),tq.clear=e=>tj.useLoader.clear(e9,e),tq.setDecoderPath=e=>{tQ=e};var tX=e.i(89887);let tW=`
vec3 interiorLinearToSRGB(vec3 linear) {
vec3 higher = pow(linear, vec3(1.0/2.4)) * 1.055 - 0.055;
vec3 lower = linear * 12.92;
return mix(lower, higher, step(vec3(0.0031308), linear));
}
vec3 interiorSRGBToLinear(vec3 srgb) {
vec3 higher = pow((srgb + 0.055) / 1.055, vec3(2.4));
vec3 lower = srgb / 12.92;
return mix(lower, higher, step(vec3(0.04045), srgb));
}
// Debug grid overlay function using screen-space derivatives for sharp, anti-aliased lines
// Returns 1.0 on grid lines, 0.0 elsewhere
float debugGrid(vec2 uv, float gridSize, float lineWidth) {
vec2 scaledUV = uv * gridSize;
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
float line = min(grid.x, grid.y);
return 1.0 - min(line / lineWidth, 1.0);
}
`;function tY({materialName:e,material:t,lightMap:r}){let n=(0,eM.useDebug)(),i=n?.debugMode??!1,a=(0,eC.textureToUrl)(e),o=(0,eE.useTexture)(a,e=>(0,ex.setupTexture)(e)),s=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),l=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),u=(0,h.useCallback)(e=>{let t;(0,eT.injectCustomFog)(e,eR.globalFogUniforms),t=l??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new A.Vector3(0,.4,1):new A.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include <common>",`#include <common>
${tW}
uniform bool useSceneLighting;
uniform vec3 interiorDebugColor;
`),e.fragmentShader=e.fragmentShader.replace("#include <lights_fragment_maps>",`// Lightmap handled in custom output calculation
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
#endif`),e.fragmentShader=e.fragmentShader.replace("#include <opaque_fragment>",`// Torque-style lighting: output = clamp(lighting \xd7 texture, 0, 1) in sRGB space
// Get texture in sRGB space (undo Three.js linear decode)
vec3 textureSRGB = interiorLinearToSRGB(diffuseColor.rgb);
// Compute lighting in sRGB space
vec3 lightingSRGB = vec3(0.0);
if (useSceneLighting) {
// Three.js computed: reflectedLight = lighting \xd7 texture_linear / PI
// Extract pure lighting: lighting = reflectedLight \xd7 PI / texture_linear
vec3 totalLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 safeTexLinear = max(diffuseColor.rgb, vec3(0.001));
vec3 extractedLighting = totalLight * PI / safeTexLinear;
// NOTE: extractedLighting is ALREADY sRGB values because mission sun/ambient colors
// are sRGB values (Torque used them directly in gamma space). Three.js treats them
// as linear but the numerical values are the same. DO NOT convert to sRGB here!
// IMPORTANT: Torque clamps scene lighting to [0,1] BEFORE adding to lightmap
// (sceneLighting.cc line 1785: tmp.clamp())
lightingSRGB = clamp(extractedLighting, 0.0, 1.0);
}
// Add lightmap contribution (for BOTH outside and inside surfaces)
// In Torque, scene lighting is ADDED to lightmaps for outside surfaces at mission load
// (stored in .ml files). Inside surfaces only have base lightmap. Both need lightmap here.
#ifdef USE_LIGHTMAP
// Lightmap is stored as linear in Three.js (decoded from sRGB texture), convert back
lightingSRGB += interiorLinearToSRGB(lightMapTexel.rgb);
#endif
// Torque clamps the sum to [0,1] per channel (sceneLighting.cc lines 1817-1827)
lightingSRGB = clamp(lightingSRGB, 0.0, 1.0);
// Torque formula: output = clamp(lighting \xd7 texture, 0, 1) in sRGB/gamma space
vec3 resultSRGB = clamp(lightingSRGB * textureSRGB, 0.0, 1.0);
// Convert back to linear for Three.js output pipeline
vec3 resultLinear = interiorSRGBToLinear(resultSRGB);
// Reassign outgoingLight before opaque_fragment consumes it
outgoingLight = resultLinear + totalEmissiveRadiance;
#include <opaque_fragment>`),e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`// Debug mode: overlay colored grid on top of normal rendering
// Blue grid = SurfaceOutsideVisible (receives scene ambient light)
// Red grid = inside surface (no scene ambient light)
#if DEBUG_MODE && defined(USE_MAP)
// gridSize=4 creates 4x4 grid per UV tile, lineWidth=1.5 is ~1.5 pixels wide
float gridIntensity = debugGrid(vMapUv, 4.0, 1.5);
gl_FragColor.rgb = mix(gl_FragColor.rgb, interiorDebugColor, gridIntensity * 0.1);
#endif
#include <tonemapping_fragment>`)},[l]),c=(0,h.useRef)(null),f=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=c.current??f.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let m={DEBUG_MODE:+!!i},p=`${l}`;return s?(0,d.jsx)("meshBasicMaterial",{ref:c,map:o,toneMapped:!1,defines:m,onBeforeCompile:u},p):(0,d.jsx)("meshLambertMaterial",{ref:f,map:o,lightMap:r,toneMapped:!1,defines:m,onBeforeCompile:u},p)}function tz(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=A.SRGBColorSpace),t??null}function tZ(e){let t,r,n,i=(0,f.c)(13),{node:a}=e;e:{let e,r;if(!a.material){let e;i[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],i[0]=e):e=i[0],t=e;break e}if(Array.isArray(a.material)){let e;i[1]!==a.material?(e=a.material.map(t$),i[1]=a.material,i[2]=e):e=i[2],t=e;break e}i[3]!==a.material?(e=tz(a.material),i[3]=a.material,i[4]=e):e=i[4],i[5]!==e?(r=[e],i[5]=e,i[6]=r):r=i[6],t=r}let o=t;return i[7]!==o||i[8]!==a.material?(r=a.material?(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(a.material)?a.material.map((e,t)=>(0,d.jsx)(tY,{materialName:e.userData.resource_path,material:e,lightMap:o[t]},t)):(0,d.jsx)(tY,{materialName:a.material.userData.resource_path,material:a.material,lightMap:o[0]})}):null,i[7]=o,i[8]=a.material,i[9]=r):r=i[9],i[10]!==a.geometry||i[11]!==r?(n=(0,d.jsx)("mesh",{geometry:a.geometry,castShadow:!0,receiveShadow:!0,children:r}),i[10]=a.geometry,i[11]=r,i[12]=n):n=i[12],n}function t$(e){return tz(e)}let t0=(0,h.memo)(function(e){let t,r,n,i,a,o,s=(0,f.c)(10),{object:l,interiorFile:u}=e,{nodes:c}=((o=(0,f.c)(2))[0]!==u?(a=(0,eC.interiorToUrl)(u),o[0]=u,o[1]=a):a=o[1],tq(a)),h=(0,eM.useDebug)(),m=h?.debugMode??!1;return s[0]===Symbol.for("react.memo_cache_sentinel")?(t=[0,-Math.PI/2,0],s[0]=t):t=s[0],s[1]!==c?(r=Object.entries(c).filter(t3).map(t5),s[1]=c,s[2]=r):r=s[2],s[3]!==m||s[4]!==u||s[5]!==l?(n=m?(0,d.jsxs)(tX.FloatingLabel,{children:[l._id,": ",u]}):null,s[3]=m,s[4]=u,s[5]=l,s[6]=n):n=s[6],s[7]!==r||s[8]!==n?(i=(0,d.jsxs)("group",{rotation:t,children:[r,n]}),s[7]=r,s[8]=n,s[9]=i):i=s[9],i});function t1(e){let t,r,n,i,a=(0,f.c)(9),{color:o,label:s}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("boxGeometry",{args:[10,10,10]}),a[0]=t):t=a[0],a[1]!==o?(r=(0,d.jsx)("meshStandardMaterial",{color:o,wireframe:!0}),a[1]=o,a[2]=r):r=a[2],a[3]!==o||a[4]!==s?(n=s?(0,d.jsx)(tX.FloatingLabel,{color:o,children:s}):null,a[3]=o,a[4]=s,a[5]=n):n=a[5],a[6]!==r||a[7]!==n?(i=(0,d.jsxs)("mesh",{children:[t,r,n]}),a[6]=r,a[7]=n,a[8]=i):i=a[8],i}function t2(e){let t,r=(0,f.c)(3),{label:n}=e,i=(0,eM.useDebug)(),a=i?.debugMode??!1;return r[0]!==a||r[1]!==n?(t=a?(0,d.jsx)(t1,{color:"red",label:n}):null,r[0]=a,r[1]=n,r[2]=t):t=r[2],t}let t9=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u,c=(0,f.c)(22),{object:m}=e;c[0]!==m?(t=(0,eb.getProperty)(m,"interiorFile"),c[0]=m,c[1]=t):t=c[1];let p=t;c[2]!==m?(r=(0,eb.getPosition)(m),c[2]=m,c[3]=r):r=c[3];let A=r;c[4]!==m?(n=(0,eb.getScale)(m),c[4]=m,c[5]=n):n=c[5];let g=n;c[6]!==m?(i=(0,eb.getRotation)(m),c[6]=m,c[7]=i):i=c[7];let v=i,C=`${m._id}: ${p}`;return c[8]!==C?(a=(0,d.jsx)(t2,{label:C}),c[8]=C,c[9]=a):a=c[9],c[10]===Symbol.for("react.memo_cache_sentinel")?(o=(0,d.jsx)(t1,{color:"orange"}),c[10]=o):o=c[10],c[11]!==p||c[12]!==m?(s=(0,d.jsx)(h.Suspense,{fallback:o,children:(0,d.jsx)(t0,{object:m,interiorFile:p})}),c[11]=p,c[12]=m,c[13]=s):s=c[13],c[14]!==a||c[15]!==s?(l=(0,d.jsx)(eW,{fallback:a,children:s}),c[14]=a,c[15]=s,c[16]=l):l=c[16],c[17]!==A||c[18]!==v||c[19]!==g||c[20]!==l?(u=(0,d.jsx)("group",{position:A,quaternion:v,scale:g,children:l}),c[17]=A,c[18]=v,c[19]=g,c[20]=l,c[21]=u):u=c[21],u});function t3(e){let[,t]=e;return t.isMesh}function t5(e){let[t,r]=e;return(0,d.jsx)(tZ,{node:r},t)}function t8(e,{path:t}){let[r]=(0,tj.useLoader)(A.CubeTextureLoader,[e],e=>e.setPath(t));return r}t8.preload=(e,{path:t})=>tj.useLoader.preload(A.CubeTextureLoader,[e],e=>e.setPath(t));let t4=()=>{};function t6(e){return e.wrapS=A.RepeatWrapping,e.wrapT=A.RepeatWrapping,e.minFilter=A.LinearFilter,e.magFilter=A.LinearFilter,e.colorSpace=A.NoColorSpace,e.needsUpdate=!0,e}let t7=`
attribute float alpha;
uniform vec2 uvOffset;
varying vec2 vUv;
varying float vAlpha;
void main() {
// Apply UV offset for scrolling
vUv = uv + uvOffset;
vAlpha = alpha;
vec4 pos = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
// Set depth to far plane so clouds are always visible and behind other geometry
gl_Position = pos.xyww;
}
`,re=`
uniform sampler2D cloudTexture;
uniform float debugMode;
uniform int layerIndex;
varying vec2 vUv;
varying float vAlpha;
// Debug grid using screen-space derivatives for sharp, anti-aliased lines
float debugGrid(vec2 uv, float gridSize, float lineWidth) {
vec2 scaledUV = uv * gridSize;
vec2 grid = abs(fract(scaledUV - 0.5) - 0.5) / fwidth(scaledUV);
float line = min(grid.x, grid.y);
return 1.0 - min(line / lineWidth, 1.0);
}
void main() {
vec4 texColor = texture2D(cloudTexture, vUv);
// Tribes 2 uses GL_MODULATE: final = texture \xd7 vertex color
// Vertex color is white with varying alpha, so:
// Final RGB = Texture RGB \xd7 1.0 = Texture RGB
// Final Alpha = Texture Alpha \xd7 Vertex Alpha
float finalAlpha = texColor.a * vAlpha;
vec3 color = texColor.rgb;
// Debug mode: overlay R/G/B grid for layers 0/1/2
if (debugMode > 0.5) {
float gridIntensity = debugGrid(vUv, 4.0, 1.5);
vec3 gridColor;
if (layerIndex == 0) {
gridColor = vec3(1.0, 0.0, 0.0); // Red
} else if (layerIndex == 1) {
gridColor = vec3(0.0, 1.0, 0.0); // Green
} else {
gridColor = vec3(0.0, 0.0, 1.0); // Blue
}
color = mix(color, gridColor, gridIntensity * 0.5);
}
// Output clouds with texture color and combined alpha
gl_FragColor = vec4(color, finalAlpha);
}
`;function rt({textureUrl:e,radius:t,heightPercent:r,speed:n,windDirection:i,layerIndex:a}){let{debugMode:o}=(0,eM.useDebug)(),{animationEnabled:s}=(0,eM.useSettings)(),l=(0,h.useRef)(null),u=(0,eE.useTexture)(e,t6),c=(0,h.useMemo)(()=>{let e=r-.05;return function(e,t,r,n){var i;let a,o,s,l,u,c,d,f,h,m,p,g,v,C,B,y,b,x=new A.BufferGeometry,E=new Float32Array(75),S=new Float32Array(50),F=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],M=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*M,a=e-t*M,o=e*F[n];E[3*n]=i,E[3*n+1]=o,E[3*n+2]=a,S[2*n]=r,S[2*n+1]=t}i=E,a=e=>({x:i[3*e],y:i[3*e+1],z:i[3*e+2]}),o=(e,t,r,n)=>{i[3*e]=t,i[3*e+1]=r,i[3*e+2]=n},s=a(1),l=a(3),u=a(5),c=a(6),d=a(8),f=a(9),h=a(15),m=a(16),p=a(18),g=a(19),v=a(21),C=a(23),B=u.x+(s.x-u.x)*.5,y=u.y+(s.y-u.y)*.5,b=u.z+(s.z-u.z)*.5,o(0,c.x+(B-c.x)*2,c.y+(y-c.y)*2,c.z+(b-c.z)*2),B=f.x+(l.x-f.x)*.5,y=f.y+(l.y-f.y)*.5,b=f.z+(l.z-f.z)*.5,o(4,d.x+(B-d.x)*2,d.y+(y-d.y)*2,d.z+(b-d.z)*2),B=v.x+(h.x-v.x)*.5,y=v.y+(h.y-v.y)*.5,b=v.z+(h.z-v.z)*.5,o(20,m.x+(B-m.x)*2,m.y+(y-m.y)*2,m.z+(b-m.z)*2),B=C.x+(g.x-C.x)*.5,y=C.y+(g.y-C.y)*.5,b=C.z+(g.z-C.z)*.5,o(24,p.x+(B-p.x)*2,p.y+(y-p.y)*2,p.z+(b-p.z)*2);let T=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(E,e),R=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;R.push(r,i,a),R.push(r,a,n)}return x.setIndex(R),x.setAttribute("position",new A.Float32BufferAttribute(E,3)),x.setAttribute("uv",new A.Float32BufferAttribute(S,2)),x.setAttribute("alpha",new A.Float32BufferAttribute(T,1)),x.computeBoundingSphere(),x}(t,r,e,0)},[t,r]);(0,h.useEffect)(()=>()=>{c.dispose()},[c]);let f=(0,h.useMemo)(()=>new A.ShaderMaterial({uniforms:{cloudTexture:{value:u},uvOffset:{value:new A.Vector2(0,0)},debugMode:{value:+!!o},layerIndex:{value:a}},vertexShader:t7,fragmentShader:re,transparent:!0,depthWrite:!1,side:A.DoubleSide}),[u,o,a]);return(0,h.useEffect)(()=>()=>{f.dispose()},[f]),(0,eB.useFrame)(s?(e,t)=>{let r=1e3*t/32;l.current??=new A.Vector2(0,0),l.current.x+=i.x*n*r,l.current.y+=i.y*n*r,l.current.x-=Math.floor(l.current.x),l.current.y-=Math.floor(l.current.y),f.uniforms.uvOffset.value.copy(l.current)}:t4),(0,d.jsx)("mesh",{geometry:c,frustumCulled:!1,renderOrder:10,children:(0,d.jsx)("primitive",{object:f,attach:"material"})})}function rr(e){var t;let r,n,i,a,o,s,l,u,c,m,p,g,v,C,B,y,b,x,E,S=(0,f.c)(37),{object:F}=e;S[0]!==F?(r=(0,eb.getProperty)(F,"materialList"),S[0]=F,S[1]=r):r=S[1];let{data:M}=(t=r,(x=(0,f.c)(7))[0]!==t?(B=["detailMapList",t],y=()=>(0,eC.loadDetailMapList)(t),x[0]=t,x[1]=B,x[2]=y):(B=x[1],y=x[2]),E=!!t,x[3]!==B||x[4]!==y||x[5]!==E?(b={queryKey:B,queryFn:y,enabled:E},x[3]=B,x[4]=y,x[5]=E,x[6]=b):b=x[6],eg(b,eo,void 0));S[2]!==F?(n=(0,eb.getFloat)(F,"visibleDistance")??500,S[2]=F,S[3]=n):n=S[3];let T=.95*n;S[4]!==F?(i=(0,eb.getFloat)(F,"cloudSpeed1")??1e-4,S[4]=F,S[5]=i):i=S[5],S[6]!==F?(a=(0,eb.getFloat)(F,"cloudSpeed2")??2e-4,S[6]=F,S[7]=a):a=S[7],S[8]!==F?(o=(0,eb.getFloat)(F,"cloudSpeed3")??3e-4,S[8]=F,S[9]=o):o=S[9],S[10]!==i||S[11]!==a||S[12]!==o?(s=[i,a,o],S[10]=i,S[11]=a,S[12]=o,S[13]=s):s=S[13];let R=s;S[14]!==F?(l=(0,eb.getFloat)(F,"cloudHeightPer1")??.35,S[14]=F,S[15]=l):l=S[15],S[16]!==F?(u=(0,eb.getFloat)(F,"cloudHeightPer2")??.25,S[16]=F,S[17]=u):u=S[17],S[18]!==F?(c=(0,eb.getFloat)(F,"cloudHeightPer3")??.2,S[18]=F,S[19]=c):c=S[19],S[20]!==l||S[21]!==u||S[22]!==c?(m=[l,u,c],S[20]=l,S[21]=u,S[22]=c,S[23]=m):m=S[23];let w=m;if(S[24]!==F){e:{let e,t=(0,eb.getProperty)(F,"windVelocity");if(t){let[e,r]=t.split(" ").map(rn);if(0!==e||0!==r){p=new A.Vector2(r,-e).normalize();break e}}S[26]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector2(1,0),S[26]=e):e=S[26],p=e}S[24]=F,S[25]=p}else p=S[25];let D=p;t:{let e;if(!M){let e;S[27]===Symbol.for("react.memo_cache_sentinel")?(e=[],S[27]=e):e=S[27],g=e;break t}if(S[28]!==w||S[29]!==R||S[30]!==M){e=[];for(let t=0;t<3;t++){let r=M[7+t];r&&e.push({texture:r,height:w[t],speed:R[t]})}S[28]=w,S[29]=R,S[30]=M,S[31]=e}else e=S[31];g=e}let I=g,G=(0,h.useRef)(null);return(S[32]===Symbol.for("react.memo_cache_sentinel")?(v=e=>{let{camera:t}=e;G.current&&G.current.position.copy(t.position)},S[32]=v):v=S[32],(0,eB.useFrame)(v),I&&0!==I.length)?(S[33]!==I||S[34]!==T||S[35]!==D?(C=(0,d.jsx)("group",{ref:G,children:I.map((e,t)=>{let r=(0,eC.textureToUrl)(e.texture);return(0,d.jsx)(h.Suspense,{fallback:null,children:(0,d.jsx)(rt,{textureUrl:r,radius:T,heightPercent:e.height,speed:e.speed,windDirection:D,layerIndex:t})},t)})}),S[33]=I,S[34]=T,S[35]=D,S[36]=C):C=S[36],C):null}function rn(e){return parseFloat(e)}let ri=!1;function ra(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new A.Color().setRGB(t,r,n),new A.Color().setRGB(t,r,n).convertSRGBToLinear()]}function ro({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:n}=(0,ey.useThree)(),i=t8(e,{path:""}),a=!!t,o=(0,h.useMemo)(()=>n.projectionMatrixInverse,[n]),s=(0,h.useMemo)(()=>r?(0,eR.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),l=(0,h.useRef)({skybox:{value:i},fogColor:{value:t??new A.Color(0,0,0)},enableFog:{value:a},inverseProjectionMatrix:{value:o},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eR.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:.18}}),u=(0,h.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,h.useEffect)(()=>{l.current.skybox.value=i,l.current.fogColor.value=t??new A.Color(0,0,0),l.current.enableFog.value=a,l.current.fogVolumeData.value=s,l.current.horizonFogHeight.value=u},[i,t,a,s,u]),(0,d.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,d.jsxs)("bufferGeometry",{children:[(0,d.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,d.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,d.jsx)("shaderMaterial",{uniforms:l.current,vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position.xy, 0.9999, 1.0);
}
`,fragmentShader:`
uniform samplerCube skybox;
uniform vec3 fogColor;
uniform bool enableFog;
uniform mat4 inverseProjectionMatrix;
uniform mat4 cameraMatrixWorld;
uniform float cameraHeight;
uniform float fogVolumeData[12];
uniform float horizonFogHeight;
varying vec2 vUv;
// Convert linear to sRGB for display
// shaderMaterial does NOT get automatic linear->sRGB output conversion
// Use proper sRGB transfer function (not simplified gamma 2.2) to match Three.js
vec3 linearToSRGB(vec3 linear) {
vec3 low = linear * 12.92;
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
return mix(low, high, step(vec3(0.0031308), linear));
}
void main() {
vec2 ndc = vUv * 2.0 - 1.0;
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
viewPos.xyz /= viewPos.w;
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
direction = vec3(direction.z, direction.y, -direction.x);
// Sample skybox - Three.js CubeTexture with SRGBColorSpace auto-converts to linear
vec4 skyColor = textureCube(skybox, direction);
vec3 finalColor;
if (enableFog) {
vec3 effectiveFogColor = fogColor;
// Calculate how much fog volume the ray passes through
// For skybox at "infinite" distance, the relevant height is how much
// of the volume is above/below camera depending on view direction
float volumeFogInfluence = 0.0;
for (int i = 0; i < 3; i++) {
int offset = i * 4;
float volVisDist = fogVolumeData[offset + 0];
float volMinH = fogVolumeData[offset + 1];
float volMaxH = fogVolumeData[offset + 2];
float volPct = fogVolumeData[offset + 3];
if (volVisDist <= 0.0) continue;
// Check if camera is inside this volume
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
// Camera is inside the fog volume
// Looking horizontally or up at shallow angles means ray travels
// through more fog before exiting the volume
float heightAboveCamera = volMaxH - cameraHeight;
float heightBelowCamera = cameraHeight - volMinH;
float volumeHeight = volMaxH - volMinH;
// For horizontal rays (direction.y ≈ 0), maximum fog influence
// For rays going up steeply, less fog (exits volume quickly)
// For rays going down, more fog (travels through volume below)
float rayInfluence;
if (direction.y >= 0.0) {
// Looking up: influence based on how steep we're looking
// Shallow angles = long path through fog = high influence
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
} else {
// Looking down: always high fog (into the volume)
rayInfluence = 1.0;
}
// Scale by percentage and volume depth factor
volumeFogInfluence += rayInfluence * volPct;
}
}
// Base fog factor from view direction (for haze at horizon)
// In Torque, the fog "bans" (bands) are rendered as geometry from
// height 0 (HORIZON) to height 60 (OFFSET_HEIGHT) on the skybox.
// The skybox corner is at mSkyBoxPt.x = mRadius / sqrt(3).
//
// horizonFogHeight is the direction.y value where the fog band ends:
// horizonFogHeight = 60 / sqrt(skyBoxPt.x^2 + 60^2)
//
// For Firestorm (visDist=600): mRadius=570, skyBoxPt.x=329, horizonFogHeight≈0.18
//
// Torque renders the fog bands as geometry with linear vertex alpha
// interpolation. We use a squared curve (t^2) to create a gentler
// falloff at the top of the gradient, matching Tribes 2's appearance.
float baseFogFactor;
if (direction.y <= 0.0) {
// Looking at or below horizon: full fog
baseFogFactor = 1.0;
} else if (direction.y >= horizonFogHeight) {
// Above fog band: no fog
baseFogFactor = 0.0;
} else {
// Within fog band: squared curve for gentler falloff at top
float t = direction.y / horizonFogHeight;
baseFogFactor = (1.0 - t) * (1.0 - t);
}
// Combine base fog with volume fog influence
// When inside a volume, increase fog intensity
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
finalColor = mix(skyColor.rgb, effectiveFogColor, finalFogFactor);
} else {
finalColor = skyColor.rgb;
}
// Convert linear result to sRGB for display
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
}
`,depthWrite:!1,depthTest:!1})]})}function rs(e){let t,r,n,i,a=(0,f.c)(6),{materialList:o,fogColor:s,fogState:l}=e,{data:u}=((i=(0,f.c)(2))[0]!==o?(n={queryKey:["detailMapList",o],queryFn:()=>(0,eC.loadDetailMapList)(o)},i[0]=o,i[1]=n):n=i[1],eg(n,eo,void 0));a[0]!==u?(t=u?[(0,eC.textureToUrl)(u[1]),(0,eC.textureToUrl)(u[3]),(0,eC.textureToUrl)(u[4]),(0,eC.textureToUrl)(u[5]),(0,eC.textureToUrl)(u[0]),(0,eC.textureToUrl)(u[2])]:null,a[0]=u,a[1]=t):t=a[1];let c=t;return c?(a[2]!==s||a[3]!==l||a[4]!==c?(r=(0,d.jsx)(ro,{skyBoxFiles:c,fogColor:s,fogState:l}),a[2]=s,a[3]=l,a[4]=c,a[5]=r):r=a[5],r):null}function rl({skyColor:e,fogColor:t,fogState:r}){let{camera:n}=(0,ey.useThree)(),i=!!t,a=(0,h.useMemo)(()=>n.projectionMatrixInverse,[n]),o=(0,h.useMemo)(()=>r?(0,eR.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),s=(0,h.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),l=(0,h.useRef)({skyColor:{value:e},fogColor:{value:t??new A.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:a},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eR.globalFogUniforms.cameraHeight,fogVolumeData:{value:o},horizonFogHeight:{value:s}});return(0,h.useEffect)(()=>{l.current.skyColor.value=e,l.current.fogColor.value=t??new A.Color(0,0,0),l.current.enableFog.value=i,l.current.fogVolumeData.value=o,l.current.horizonFogHeight.value=s},[e,t,i,o,s]),(0,d.jsxs)("mesh",{renderOrder:-1e3,frustumCulled:!1,children:[(0,d.jsxs)("bufferGeometry",{children:[(0,d.jsx)("bufferAttribute",{attach:"attributes-position",array:new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),count:3,itemSize:3}),(0,d.jsx)("bufferAttribute",{attach:"attributes-uv",array:new Float32Array([0,0,2,0,0,2]),count:3,itemSize:2})]}),(0,d.jsx)("shaderMaterial",{uniforms:l.current,vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position.xy, 0.9999, 1.0);
}
`,fragmentShader:`
uniform vec3 skyColor;
uniform vec3 fogColor;
uniform bool enableFog;
uniform mat4 inverseProjectionMatrix;
uniform mat4 cameraMatrixWorld;
uniform float cameraHeight;
uniform float fogVolumeData[12];
uniform float horizonFogHeight;
varying vec2 vUv;
// Convert linear to sRGB for display
vec3 linearToSRGB(vec3 linear) {
vec3 low = linear * 12.92;
vec3 high = 1.055 * pow(linear, vec3(1.0 / 2.4)) - 0.055;
return mix(low, high, step(vec3(0.0031308), linear));
}
void main() {
vec2 ndc = vUv * 2.0 - 1.0;
vec4 viewPos = inverseProjectionMatrix * vec4(ndc, 1.0, 1.0);
viewPos.xyz /= viewPos.w;
vec3 direction = normalize((cameraMatrixWorld * vec4(viewPos.xyz, 0.0)).xyz);
direction = vec3(direction.z, direction.y, -direction.x);
vec3 finalColor;
if (enableFog) {
// Calculate volume fog influence (same logic as SkyBoxTexture)
float volumeFogInfluence = 0.0;
for (int i = 0; i < 3; i++) {
int offset = i * 4;
float volVisDist = fogVolumeData[offset + 0];
float volMinH = fogVolumeData[offset + 1];
float volMaxH = fogVolumeData[offset + 2];
float volPct = fogVolumeData[offset + 3];
if (volVisDist <= 0.0) continue;
if (cameraHeight >= volMinH && cameraHeight <= volMaxH) {
float rayInfluence;
if (direction.y >= 0.0) {
rayInfluence = 1.0 - smoothstep(0.0, 0.3, direction.y);
} else {
rayInfluence = 1.0;
}
volumeFogInfluence += rayInfluence * volPct;
}
}
// Base fog factor from view direction
float baseFogFactor;
if (direction.y <= 0.0) {
baseFogFactor = 1.0;
} else if (direction.y >= horizonFogHeight) {
baseFogFactor = 0.0;
} else {
float t = direction.y / horizonFogHeight;
baseFogFactor = (1.0 - t) * (1.0 - t);
}
// Combine base fog with volume fog influence
float finalFogFactor = min(1.0, baseFogFactor + volumeFogInfluence * 0.5);
finalColor = mix(skyColor, fogColor, finalFogFactor);
} else {
finalColor = skyColor;
}
gl_FragColor = vec4(linearToSRGB(finalColor), 1.0);
}
`,depthWrite:!1,depthTest:!1})]})}function ru(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function rc({fogState:e,enabled:t}){let{scene:r,camera:n}=(0,ey.useThree)(),i=(0,h.useRef)(null),a=(0,h.useMemo)(()=>(0,eR.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,h.useEffect)(()=>{ri||((0,eT.installCustomFogShader)(),ri=!0)},[]),(0,h.useEffect)(()=>{(0,eR.resetGlobalFogUniforms)();let[t,o]=ru(e,n.position.y),s=new A.Fog(e.fogColor,t,o);return r.fog=s,i.current=s,(0,eR.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,eR.resetGlobalFogUniforms)()}},[r,n,e,a]),(0,h.useEffect)(()=>{let r=i.current;if(r)if(t){let[t,i]=ru(e,n.position.y);r.near=t,r.far=i}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,eB.useFrame)(()=>{let r=i.current;if(!r)return;let o=n.position.y;if((0,eR.updateGlobalFogUniforms)(o,a,t),t){let[t,n]=ru(e,o);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}function rd(e){return parseFloat(e)}function rf(e){return parseFloat(e)}function rh(e){return parseFloat(e)}let rm=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function rp(e){return rm.test(e)}let rA=(0,h.createContext)(null);function rg(){let e=(0,h.useContext)(rA);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function rv(e){let t,r,n,i=(0,f.c)(10),{children:a,object:o,shapeName:s,type:l}=e;i[0]!==s?(t=rp(s),i[0]=s,i[1]=t):t=i[1];let u=t;i[2]!==u||i[3]!==o||i[4]!==s||i[5]!==l?(r={object:o,shapeName:s,type:l,isOrganic:u},i[2]=u,i[3]=o,i[4]=s,i[5]=l,i[6]=r):r=i[6];let c=r;return i[7]!==a||i[8]!==c?(n=(0,d.jsx)(rA.Provider,{value:c,children:a}),i[7]=a,i[8]=c,i[9]=n):n=i[9],n}var rC=e.i(51475);let rB=new Map;function ry(e){e.onBeforeCompile=t=>{(0,eT.injectCustomFog)(t,eR.globalFogUniforms),e instanceof A.MeshLambertMaterial&&(t.uniforms.shapeDirectionalFactor={value:1},t.uniforms.shapeAmbientFactor={value:1.5},t.fragmentShader=t.fragmentShader.replace("#include <common>",`#include <common>
uniform float shapeDirectionalFactor;
uniform float shapeAmbientFactor;
`),t.fragmentShader=t.fragmentShader.replace("#include <lights_fragment_end>",`#include <lights_fragment_end>
// Apply shape-specific lighting multipliers
reflectedLight.directDiffuse *= shapeDirectionalFactor;
reflectedLight.indirectDiffuse *= shapeAmbientFactor;
`))}}function rb(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive");if(r.has("SelfIlluminating")){let e=new A.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,fog:!0,...a&&{blending:A.AdditiveBlending}});return ry(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new A.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new A.MeshLambertMaterial({...e,side:0});return ry(r),ry(n),[r,n]}let o=new A.MeshLambertMaterial({map:t,side:2,reflectivity:0});return ry(o),o}let rx=(0,h.memo)(function(e){let t,r,n,i,a,o,s=(0,f.c)(35),{material:l,shapeName:u,geometry:c,backGeometry:h,castShadow:m,receiveShadow:p}=e,g=void 0!==m&&m,v=void 0!==p&&p,C=l.userData.resource_path;s[0]!==l.userData.flag_names?(t=l.userData.flag_names??[],s[0]=l.userData.flag_names,s[1]=t):t=s[1],s[2]!==t?(r=new Set(t),s[2]=t,s[3]=r):r=s[3];let B=r,y=function(e){var t;let r,n,i,a,o=(0,f.c)(14),{animationEnabled:s}=(0,eM.useSettings)();o[0]!==e?(r={queryKey:["ifl",e],queryFn:()=>(0,eC.loadImageFrameList)(e)},o[0]=e,o[1]=r):r=o[1];let{data:l}=eg({...r,enabled:!0,suspense:!0,throwOnError:ep,placeholderData:void 0},eo,void 0);if(o[2]!==l||o[3]!==e){let t;o[5]!==e?(t=t=>(0,eC.iflTextureToUrl)(t.name,e),o[5]=e,o[6]=t):t=o[6],n=l.map(t),o[2]=l,o[3]=e,o[4]=n}else n=o[4];let u=n,c=(0,eE.useTexture)(u);if(o[7]!==l||o[8]!==e||o[9]!==c){let r;if(!(i=rB.get(e))){let t,r,n,a,o,s,l,u,d;r=(t=c[0].image).width,n=t.height,o=Math.ceil(Math.sqrt(a=c.length)),s=Math.ceil(a/o),(l=document.createElement("canvas")).width=r*o,l.height=n*s,u=l.getContext("2d"),c.forEach((e,t)=>{let i=Math.floor(t/o);u.drawImage(e.image,t%o*r,i*n)}),(d=new A.CanvasTexture(l)).colorSpace=A.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=A.NearestFilter,d.magFilter=A.NearestFilter,d.wrapS=A.ClampToEdgeWrapping,d.wrapT=A.ClampToEdgeWrapping,d.repeat.set(1/o,1/s),i={texture:d,columns:o,rows:s,frameCount:a,frameStartTicks:[],totalTicks:0,lastFrame:-1},rB.set(e,i)}r=0,(t=i).frameStartTicks=l.map(e=>{let t=r;return r+=e.frameCount,t}),t.totalTicks=r,o[7]=l,o[8]=e,o[9]=c,o[10]=i}else i=o[10];let d=i;return o[11]!==s||o[12]!==d?(a=e=>{let t=s?function(e,t){if(0===e.totalTicks)return 0;let r=t%e.totalTicks,{frameStartTicks:n}=e;for(let e=n.length-1;e>=0;e--)if(r>=n[e])return e;return 0}(d,e):0;!function(e,t){if(t===e.lastFrame)return;e.lastFrame=t;let r=t%e.columns,n=e.rows-1-Math.floor(t/e.columns);e.texture.offset.set(r/e.columns,n/e.rows)}(d,t)},o[11]=s,o[12]=d,o[13]=a):a=o[13],(0,rC.useTick)(a),d.texture}(`textures/${C}.ifl`);s[4]!==u?(n=u&&rp(u),s[4]=u,s[5]=n):n=s[5];let b=n;s[6]!==B||s[7]!==b||s[8]!==l||s[9]!==y?(i=rb(l,y,B,b),s[6]=B,s[7]=b,s[8]=l,s[9]=y,s[10]=i):i=s[10];let x=i;if(Array.isArray(x)){let e,t,r,n,i,a=h||c;return s[11]!==x[0]?(e=(0,d.jsx)("primitive",{object:x[0],attach:"material"}),s[11]=x[0],s[12]=e):e=s[12],s[13]!==g||s[14]!==v||s[15]!==a||s[16]!==e?(t=(0,d.jsx)("mesh",{geometry:a,castShadow:g,receiveShadow:v,children:e}),s[13]=g,s[14]=v,s[15]=a,s[16]=e,s[17]=t):t=s[17],s[18]!==x[1]?(r=(0,d.jsx)("primitive",{object:x[1],attach:"material"}),s[18]=x[1],s[19]=r):r=s[19],s[20]!==g||s[21]!==c||s[22]!==v||s[23]!==r?(n=(0,d.jsx)("mesh",{geometry:c,castShadow:g,receiveShadow:v,children:r}),s[20]=g,s[21]=c,s[22]=v,s[23]=r,s[24]=n):n=s[24],s[25]!==n||s[26]!==t?(i=(0,d.jsxs)(d.Fragment,{children:[t,n]}),s[25]=n,s[26]=t,s[27]=i):i=s[27],i}return s[28]!==x?(a=(0,d.jsx)("primitive",{object:x,attach:"material"}),s[28]=x,s[29]=a):a=s[29],s[30]!==g||s[31]!==c||s[32]!==v||s[33]!==a?(o=(0,d.jsx)("mesh",{geometry:c,castShadow:g,receiveShadow:v,children:a}),s[30]=g,s[31]=c,s[32]=v,s[33]=a,s[34]=o):o=s[34],o}),rE=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(40),{material:c,shapeName:h,geometry:m,backGeometry:p,castShadow:A,receiveShadow:g}=e,v=void 0!==A&&A,C=void 0!==g&&g,B=c.userData.resource_path;u[0]!==c.userData.flag_names?(t=c.userData.flag_names??[],u[0]=c.userData.flag_names,u[1]=t):t=u[1],u[2]!==t?(r=new Set(t),u[2]=t,u[3]=r):r=u[3];let y=r;B||console.warn(`No resource_path was found on "${h}" - rendering fallback.`),u[4]!==B?(n=B?(0,eC.textureToUrl)(B):eC.FALLBACK_TEXTURE_URL,u[4]=B,u[5]=n):n=u[5];let b=n;u[6]!==h?(i=h&&rp(h),u[6]=h,u[7]=i):i=u[7];let x=i,E=y.has("Translucent");u[8]!==x||u[9]!==E?(a=e=>x||E?(0,ex.setupTexture)(e,{disableMipmaps:!0}):(0,ex.setupTexture)(e),u[8]=x,u[9]=E,u[10]=a):a=u[10];let S=(0,eE.useTexture)(b,a);u[11]!==y||u[12]!==x||u[13]!==c||u[14]!==S?(o=rb(c,S,y,x),u[11]=y,u[12]=x,u[13]=c,u[14]=S,u[15]=o):o=u[15];let F=o;if(Array.isArray(F)){let e,t,r,n,i,a=p||m;return u[16]!==F[0]?(e=(0,d.jsx)("primitive",{object:F[0],attach:"material"}),u[16]=F[0],u[17]=e):e=u[17],u[18]!==v||u[19]!==C||u[20]!==e||u[21]!==a?(t=(0,d.jsx)("mesh",{geometry:a,castShadow:v,receiveShadow:C,children:e}),u[18]=v,u[19]=C,u[20]=e,u[21]=a,u[22]=t):t=u[22],u[23]!==F[1]?(r=(0,d.jsx)("primitive",{object:F[1],attach:"material"}),u[23]=F[1],u[24]=r):r=u[24],u[25]!==v||u[26]!==m||u[27]!==C||u[28]!==r?(n=(0,d.jsx)("mesh",{geometry:m,castShadow:v,receiveShadow:C,children:r}),u[25]=v,u[26]=m,u[27]=C,u[28]=r,u[29]=n):n=u[29],u[30]!==t||u[31]!==n?(i=(0,d.jsxs)(d.Fragment,{children:[t,n]}),u[30]=t,u[31]=n,u[32]=i):i=u[32],i}return u[33]!==F?(s=(0,d.jsx)("primitive",{object:F,attach:"material"}),u[33]=F,u[34]=s):s=u[34],u[35]!==v||u[36]!==m||u[37]!==C||u[38]!==s?(l=(0,d.jsx)("mesh",{geometry:m,castShadow:v,receiveShadow:C,children:s}),u[35]=v,u[36]=m,u[37]=C,u[38]=s,u[39]=l):l=u[39],l}),rS=(0,h.memo)(function(e){let t=(0,f.c)(14),{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:o,receiveShadow:s}=e,l=void 0!==o&&o,u=void 0!==s&&s,c=new Set(r.userData.flag_names??[]).has("IflMaterial"),h=r.userData.resource_path;if(c&&h){let e;return t[0]!==a||t[1]!==l||t[2]!==i||t[3]!==r||t[4]!==u||t[5]!==n?(e=(0,d.jsx)(rx,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:l,receiveShadow:u}),t[0]=a,t[1]=l,t[2]=i,t[3]=r,t[4]=u,t[5]=n,t[6]=e):e=t[6],e}if(!r.name)return null;{let e;return t[7]!==a||t[8]!==l||t[9]!==i||t[10]!==r||t[11]!==u||t[12]!==n?(e=(0,d.jsx)(rE,{material:r,shapeName:n,geometry:i,backGeometry:a,castShadow:l,receiveShadow:u}),t[7]=a,t[8]=l,t[9]=i,t[10]=r,t[11]=u,t[12]=n,t[13]=e):e=t[13],e}});function rF(e){let t,r,n,i,a=(0,f.c)(9),{color:o,label:s}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)("boxGeometry",{args:[10,10,10]}),a[0]=t):t=a[0],a[1]!==o?(r=(0,d.jsx)("meshStandardMaterial",{color:o,wireframe:!0}),a[1]=o,a[2]=r):r=a[2],a[3]!==o||a[4]!==s?(n=s?(0,d.jsx)(tX.FloatingLabel,{color:o,children:s}):null,a[3]=o,a[4]=s,a[5]=n):n=a[5],a[6]!==r||a[7]!==n?(i=(0,d.jsxs)("mesh",{children:[t,r,n]}),a[6]=r,a[7]=n,a[8]=i):i=a[8],i}function rM(e){let t,r=(0,f.c)(4),{color:n,label:i}=e,{debugMode:a}=(0,eM.useDebug)();return r[0]!==n||r[1]!==a||r[2]!==i?(t=a?(0,d.jsx)(rF,{color:n,label:i}):null,r[0]=n,r[1]=a,r[2]=i,r[3]=t):t=r[3],t}function rT(e){let t,r,n,i,a,o=(0,f.c)(13),{loadingColor:s,children:l}=e,u=void 0===s?"yellow":s,{object:c,shapeName:m}=rg();if(!m){let e,t=`${c._id}: <missing>`;return o[0]!==t?(e=(0,d.jsx)(rM,{color:"orange",label:t}),o[0]=t,o[1]=e):e=o[1],e}let p=`${c._id}: ${m}`;return o[2]!==p?(t=(0,d.jsx)(rM,{color:"red",label:p}),o[2]=p,o[3]=t):t=o[3],o[4]!==u?(r=(0,d.jsx)(rF,{color:u}),o[4]=u,o[5]=r):r=o[5],o[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,d.jsx)(rR,{}),o[6]=n):n=o[6],o[7]!==l||o[8]!==r?(i=(0,d.jsxs)(h.Suspense,{fallback:r,children:[n,l]}),o[7]=l,o[8]=r,o[9]=i):i=o[9],o[10]!==t||o[11]!==i?(a=(0,d.jsx)(eW,{fallback:t,children:i}),o[10]=t,o[11]=i,o[12]=a):a=o[12],a}let rR=(0,h.memo)(function(){var e;let t,r,n,i,a,o,s,l,u=(0,f.c)(19),{object:c,shapeName:m,isOrganic:p}=rg(),{debugMode:A}=(0,eM.useDebug)(),{nodes:g}=((l=(0,f.c)(2))[0]!==m?(s=(0,eC.shapeToUrl)(m),l[0]=m,l[1]=s):s=l[1],tq(s));if(u[0]!==g){e:{let r,n=Object.values(g).filter(rw);if(n.length>0){let r;e=n[0].skeleton,r=new Set,e.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),t=r;break e}u[2]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,u[2]=r):r=u[2],t=r}u[0]=g,u[1]=t}else t=u[1];let v=t;u[3]!==v||u[4]!==p||u[5]!==g?(r=Object.entries(g).filter(rD).map(e=>{let[,t]=e,r=function(e,t){if(0===t.size||!e.attributes.skinIndex)return e;let r=e.attributes.skinIndex,n=e.attributes.skinWeight,i=e.index,a=Array(r.count).fill(!1);for(let e=0;e<r.count;e++)for(let i=0;i<4;i++){let o=r.array[4*e+i];if(n.array[4*e+i]>.01&&t.has(o)){a[e]=!0;break}}if(i){let t=[],r=i.array;for(let e=0;e<r.length;e+=3){let n=r[e],i=r[e+1],o=r[e+2];a[n]||a[i]||a[o]||t.push(n,i,o)}let n=e.clone();return n.setIndex(t),n}return e}(t.geometry,v),n=null;if(r){(r=r.clone()).computeVertexNormals();let e=r.attributes.position,t=r.attributes.normal,i=e.array,a=t.array,o=new Map;for(let t=0;t<e.count;t++){let e=`${i[3*t].toFixed(4)},${i[3*t+1].toFixed(4)},${i[3*t+2].toFixed(4)}`;o.has(e)||o.set(e,[]),o.get(e).push(t)}for(let e of o.values())if(e.length>1){let t=0,r=0,n=0;for(let i of e)t+=a[3*i],r+=a[3*i+1],n+=a[3*i+2];let i=Math.sqrt(t*t+r*r+n*n);for(let o of(i>0&&(t/=i,r/=i,n/=i),e))a[3*o]=t,a[3*o+1]=r,a[3*o+2]=n}if(t.needsUpdate=!0,p){let e=(n=r.clone()).attributes.normal,t=e.array;for(let e=0;e<t.length;e++)t[e]=-t[e];e.needsUpdate=!0}}return{node:t,geometry:r,backGeometry:n}}),u[3]=v,u[4]=p,u[5]=g,u[6]=r):r=u[6];let C=r,B=!p;return u[7]===Symbol.for("react.memo_cache_sentinel")?(n=[0,Math.PI/2,0],u[7]=n):n=u[7],u[8]!==B||u[9]!==C||u[10]!==m?(i=C.map(e=>{let{node:t,geometry:r,backGeometry:n}=e;return(0,d.jsx)(h.Suspense,{fallback:(0,d.jsx)("mesh",{geometry:r,children:(0,d.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:t.material?Array.isArray(t.material)?t.material.map((e,t)=>(0,d.jsx)(rS,{material:e,shapeName:m,geometry:r,backGeometry:n,castShadow:B,receiveShadow:B},t)):(0,d.jsx)(rS,{material:t.material,shapeName:m,geometry:r,backGeometry:n,castShadow:B,receiveShadow:B}):null},t.id)}),u[8]=B,u[9]=C,u[10]=m,u[11]=i):i=u[11],u[12]!==A||u[13]!==c||u[14]!==m?(a=A?(0,d.jsxs)(tX.FloatingLabel,{children:[c._id,": ",m]}):null,u[12]=A,u[13]=c,u[14]=m,u[15]=a):a=u[15],u[16]!==i||u[17]!==a?(o=(0,d.jsxs)("group",{rotation:n,children:[i,a]}),u[16]=i,u[17]=a,u[18]=o):o=u[18],o});function rw(e){return e.skeleton}function rD(e){let[,t]=e;return t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)}var rI=e.i(6112);let rG={1:"Storm",2:"Inferno"},rL=(0,h.createContext)(null);function rO(){let e=(0,h.useContext)(rL);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function r_({children:e}){let{camera:t}=(0,ey.useThree)(),[r,n]=(0,h.useState)(-1),[i,a]=(0,h.useState)({}),[o,s]=(0,h.useState)(()=>({initialized:!1,position:null,quarternion:null})),l=(0,h.useCallback)(e=>{a(t=>({...t,[e.id]:e}))},[]),u=(0,h.useCallback)(e=>{a(t=>{let{[e.id]:r,...n}=t;return n})},[]),c=Object.keys(i).length,f=(0,h.useCallback)(e=>{if(e>=0&&e<c){n(e);let r=Object.keys(i)[e],a=i[r];t.position.copy(a.position);let o=new A.Quaternion().setFromAxisAngle(new A.Vector3(0,1,0),-Math.PI/2);t.quaternion.copy(a.rotation).multiply(o)}},[t,c,i]),m=(0,h.useCallback)(()=>{f(c?(r+1)%c:-1)},[c,r,f]);(0,h.useEffect)(()=>{let e=()=>{let e=window.location.hash;if(e.startsWith("#c")){let[t,r]=e.slice(2).split("~"),n=t.split(",").map(e=>parseFloat(e)),i=r.split(",").map(e=>parseFloat(e));s({initialized:!0,position:new A.Vector3(...n),quarternion:new A.Quaternion(...i)})}else s({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,h.useEffect)(()=>{o.initialized&&o.position&&(t.position.copy(o.position),o.quarternion&&t.quaternion.copy(o.quarternion))},[t,o]),(0,h.useEffect)(()=>{o.initialized&&!o.position&&c>0&&-1===r&&f(0)},[c,f,r,o]);let p=(0,h.useMemo)(()=>({registerCamera:l,unregisterCamera:u,nextCamera:m,setCameraIndex:f,cameraCount:c}),[l,u,m,f,c]);return 0===c&&-1!==r&&n(-1),(0,d.jsx)(rL.Provider,{value:p,children:e})}let rP=(0,h.createContext)(null),rH=rP.Provider,rk=(0,h.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),rU={AudioEmitter:function(e){let t,r=(0,f.c)(3),{audioEnabled:n}=(0,eM.useSettings)();return r[0]!==n||r[1]!==e?(t=n?(0,d.jsx)(rk,{...e}):null,r[0]=n,r[1]=e,r[2]=t):t=r[2],t},Camera:function(e){let t,r,n,i,a,o=(0,f.c)(14),{object:s}=e,{registerCamera:l,unregisterCamera:u}=rO(),c=(0,h.useId)();o[0]!==s?(t=(0,eb.getProperty)(s,"dataBlock"),o[0]=s,o[1]=t):t=o[1];let d=t;o[2]!==s?(r=(0,eb.getPosition)(s),o[2]=s,o[3]=r):r=o[3];let m=r;o[4]!==s?(n=(0,eb.getRotation)(s),o[4]=s,o[5]=n):n=o[5];let p=n;return o[6]!==d||o[7]!==c||o[8]!==m||o[9]!==p||o[10]!==l||o[11]!==u?(i=()=>{if("Observer"===d){let e={id:c,position:new A.Vector3(...m),rotation:p};return l(e),()=>{u(e)}}},a=[c,d,l,u,m,p],o[6]=d,o[7]=c,o[8]=m,o[9]=p,o[10]=l,o[11]=u,o[12]=i,o[13]=a):(i=o[12],a=o[13]),(0,h.useEffect)(i,a),null},ForceFieldBare:(0,h.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:t9,Item:function(e){let t,r,n,i,a,o,s,l,u,c=(0,f.c)(23),{object:h}=e,m=eK();c[0]!==h?(t=(0,eb.getProperty)(h,"dataBlock")??"",c[0]=h,c[1]=t):t=c[1];let p=t,A=(0,rI.useDatablock)(p);c[2]!==h?(r=(0,eb.getPosition)(h),c[2]=h,c[3]=r):r=c[3];let g=r;c[4]!==h?(n=(0,eb.getScale)(h),c[4]=h,c[5]=n):n=c[5];let v=n;c[6]!==h?(i=(0,eb.getRotation)(h),c[6]=h,c[7]=i):i=c[7];let C=i;c[8]!==A?(a=(0,eb.getProperty)(A,"shapeFile"),c[8]=A,c[9]=a):a=c[9];let B=a;B||console.error(`<Item> missing shape for datablock: ${p}`);let y=p?.toLowerCase()==="flag",b=m?.team??null,x=b&&b>0?rG[b]:null,E=y&&x?`${x} Flag`:null;return c[10]!==E?(o=E?(0,d.jsx)(tX.FloatingLabel,{opacity:.6,children:E}):null,c[10]=E,c[11]=o):o=c[11],c[12]!==o?(s=(0,d.jsx)(rT,{loadingColor:"pink",children:o}),c[12]=o,c[13]=s):s=c[13],c[14]!==g||c[15]!==C||c[16]!==v||c[17]!==s?(l=(0,d.jsx)("group",{position:g,quaternion:C,scale:v,children:s}),c[14]=g,c[15]=C,c[16]=v,c[17]=s,c[18]=l):l=c[18],c[19]!==h||c[20]!==B||c[21]!==l?(u=(0,d.jsx)(rv,{type:"Item",object:h,shapeName:B,children:l}),c[19]=h,c[20]=B,c[21]=l,c[22]=u):u=c[22],u},SimGroup:function(e){let t,r,n,i,a=(0,f.c)(17),{object:o}=e,s=eK(),l=null,u=!1;if(s&&s.hasTeams){if(u=!0,null!=s.team)l=s.team;else if(o._name){let e;if(a[0]!==o._name){let t;a[2]===Symbol.for("react.memo_cache_sentinel")?(t=/^team(\d+)$/i,a[2]=t):t=a[2],e=o._name.match(t),a[0]=o._name,a[1]=e}else e=a[1];let t=e;t&&(l=parseInt(t[1],10))}}else if(o._name){let e;a[3]!==o._name?(e=o._name.toLowerCase(),a[3]=o._name,a[4]=e):e=a[4],u="teams"===e}a[5]!==u||a[6]!==o||a[7]!==s||a[8]!==l?(t={object:o,parent:s,hasTeams:u,team:l},a[5]=u,a[6]=o,a[7]=s,a[8]=l,a[9]=t):t=a[9];let c=t;return a[10]!==o._children?(r=o._children??[],a[10]=o._children,a[11]=r):r=a[11],a[12]!==r?(n=r.map(eQ),a[12]=r,a[13]=n):n=a[13],a[14]!==c||a[15]!==n?(i=(0,d.jsx)(eJ.Provider,{value:c,children:n}),a[14]=c,a[15]=n,a[16]=i):i=a[16],i},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,eM.useSettings)(),n=(0,eb.getProperty)(e,"materialList"),i=(0,h.useMemo)(()=>ra((0,eb.getProperty)(e,"SkySolidColor")),[e]),a=(0,eb.getInt)(e,"useSkyTextures")??1,o=(0,h.useMemo)(()=>(function(e,t=!0){let r=(0,eb.getFloat)(e,"fogDistance")??0,n=(0,eb.getFloat)(e,"visibleDistance")??1e3,i=(0,eb.getFloat)(e,"high_fogDistance"),a=(0,eb.getFloat)(e,"high_visibleDistance"),o=t&&null!=i&&i>0?i:r,s=t&&null!=a&&a>0?a:n,l=function(e){if(!e)return new A.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new A.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,eb.getProperty)(e,"fogColor")),u=[];for(let t=1;t<=3;t++){let r=function(e,t=1){if(!e)return null;let r=e.split(" ").map(e=>parseFloat(e));if(r.length<3)return null;let[n,i,a]=r;return n<=0||a<=i?null:{visibleDistance:n,minHeight:i,maxHeight:a,percentage:Math.max(0,Math.min(1,t))}}((0,eb.getProperty)(e,`fogVolume${t}`),1);r&&u.push(r)}let c=u.reduce((e,t)=>Math.max(e,t.maxHeight),0);return{fogDistance:o,visibleDistance:s,fogColor:l,fogVolumes:u,fogLine:c,enabled:s>o}})(e,r),[e,r]),s=(0,h.useMemo)(()=>ra((0,eb.getProperty)(e,"fogColor")),[e]),l=i||s,u=o.enabled&&t,c=o.fogColor,{scene:f,gl:m}=(0,ey.useThree)();(0,h.useEffect)(()=>{if(u){let e=c.clone();f.background=e,m.setClearColor(e)}else if(l){let e=l[0].clone();f.background=e,m.setClearColor(e)}else f.background=null;return()=>{f.background=null}},[f,m,u,c,l]);let p=i?.[1];return(0,d.jsxs)(d.Fragment,{children:[n&&a?(0,d.jsx)(h.Suspense,{fallback:null,children:(0,d.jsx)(rs,{materialList:n,fogColor:u?c:void 0,fogState:u?o:void 0},n)}):p?(0,d.jsx)(rl,{skyColor:p,fogColor:u?c:void 0,fogState:u?o:void 0}):null,(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(rr,{object:e})}),o.enabled?(0,d.jsx)(rc,{fogState:o,enabled:t}):null]})},StaticShape:function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(19),{object:c}=e;u[0]!==c?(t=(0,eb.getProperty)(c,"dataBlock")??"",u[0]=c,u[1]=t):t=u[1];let h=t,m=(0,rI.useDatablock)(h);u[2]!==c?(r=(0,eb.getPosition)(c),u[2]=c,u[3]=r):r=u[3];let p=r;u[4]!==c?(n=(0,eb.getRotation)(c),u[4]=c,u[5]=n):n=u[5];let A=n;u[6]!==c?(i=(0,eb.getScale)(c),u[6]=c,u[7]=i):i=u[7];let g=i;u[8]!==m?(a=(0,eb.getProperty)(m,"shapeFile"),u[8]=m,u[9]=a):a=u[9];let v=a;return v||console.error(`<StaticShape> missing shape for datablock: ${h}`),u[10]===Symbol.for("react.memo_cache_sentinel")?(o=(0,d.jsx)(rT,{}),u[10]=o):o=u[10],u[11]!==p||u[12]!==A||u[13]!==g?(s=(0,d.jsx)("group",{position:p,quaternion:A,scale:g,children:o}),u[11]=p,u[12]=A,u[13]=g,u[14]=s):s=u[14],u[15]!==c||u[16]!==v||u[17]!==s?(l=(0,d.jsx)(rv,{type:"StaticShape",object:c,shapeName:v,children:s}),u[15]=c,u[16]=v,u[17]=s,u[18]=l):l=u[18],l},Sun:function(e){let t,r,n,i,a,o,s,l,u,c,m=(0,f.c)(25),{object:p}=e;m[0]!==p?(t=((0,eb.getProperty)(p,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(rh),m[0]=p,m[1]=t):t=m[1];let[g,v,C]=t,B=Math.sqrt(g*g+C*C+v*v),y=g/B,b=C/B,x=v/B;m[2]!==y||m[3]!==b||m[4]!==x?(r=new A.Vector3(y,b,x),m[2]=y,m[3]=b,m[4]=x,m[5]=r):r=m[5];let E=r,S=-(5e3*E.x),F=-(5e3*E.y),M=-(5e3*E.z);m[6]!==S||m[7]!==F||m[8]!==M?(n=new A.Vector3(S,F,M),m[6]=S,m[7]=F,m[8]=M,m[9]=n):n=m[9];let T=n;if(m[10]!==p){let[e,t,r]=((0,eb.getProperty)(p,"color")??"0.7 0.7 0.7 1").split(" ").map(rf);i=new A.Color(e,t,r),m[10]=p,m[11]=i}else i=m[11];let R=i;if(m[12]!==p){let[e,t,r]=((0,eb.getProperty)(p,"ambient")??"0.5 0.5 0.5 1").split(" ").map(rd);a=new A.Color(e,t,r),m[12]=p,m[13]=a}else a=m[13];let w=a,D=E.y<0;return m[14]!==D?(o=()=>{eS.value=D},s=[D],m[14]=D,m[15]=o,m[16]=s):(o=m[15],s=m[16]),(0,h.useEffect)(o,s),m[17]!==R||m[18]!==T?(l=(0,d.jsx)("directionalLight",{position:T,color:R,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),m[17]=R,m[18]=T,m[19]=l):l=m[19],m[20]!==w?(u=(0,d.jsx)("ambientLight",{color:w,intensity:1}),m[20]=w,m[21]=u):u=m[21],m[22]!==l||m[23]!==u?(c=(0,d.jsxs)(d.Fragment,{children:[l,u]}),m[22]=l,m[23]=u,m[24]=c):c=m[24],c},TerrainBlock:eP,TSStatic:function(e){let t,r,n,i,a,o,s,l=(0,f.c)(17),{object:u}=e;l[0]!==u?(t=(0,eb.getProperty)(u,"shapeName"),l[0]=u,l[1]=t):t=l[1];let c=t;l[2]!==u?(r=(0,eb.getPosition)(u),l[2]=u,l[3]=r):r=l[3];let h=r;l[4]!==u?(n=(0,eb.getRotation)(u),l[4]=u,l[5]=n):n=l[5];let m=n;l[6]!==u?(i=(0,eb.getScale)(u),l[6]=u,l[7]=i):i=l[7];let p=i;return c||console.error("<TSStatic> missing shapeName for object",u),l[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,d.jsx)(rT,{}),l[8]=a):a=l[8],l[9]!==h||l[10]!==m||l[11]!==p?(o=(0,d.jsx)("group",{position:h,quaternion:m,scale:p,children:a}),l[9]=h,l[10]=m,l[11]=p,l[12]=o):o=l[12],l[13]!==u||l[14]!==c||l[15]!==o?(s=(0,d.jsx)(rv,{type:"TSStatic",object:u,shapeName:c,children:o}),l[13]=u,l[14]=c,l[15]=o,l[16]=s):s=l[16],s},Turret:function(e){let t,r,n,i,a,o,s,l,u,c,h,m=(0,f.c)(27),{object:p}=e;m[0]!==p?(t=(0,eb.getProperty)(p,"dataBlock")??"",m[0]=p,m[1]=t):t=m[1];let A=t;m[2]!==p?(r=(0,eb.getProperty)(p,"initialBarrel"),m[2]=p,m[3]=r):r=m[3];let g=r,v=(0,rI.useDatablock)(A),C=(0,rI.useDatablock)(g);m[4]!==p?(n=(0,eb.getPosition)(p),m[4]=p,m[5]=n):n=m[5];let B=n;m[6]!==p?(i=(0,eb.getRotation)(p),m[6]=p,m[7]=i):i=m[7];let y=i;m[8]!==p?(a=(0,eb.getScale)(p),m[8]=p,m[9]=a):a=m[9];let b=a;m[10]!==v?(o=(0,eb.getProperty)(v,"shapeFile"),m[10]=v,m[11]=o):o=m[11];let x=o;m[12]!==C?(s=(0,eb.getProperty)(C,"shapeFile"),m[12]=C,m[13]=s):s=m[13];let E=s;return x||console.error(`<Turret> missing shape for datablock: ${A}`),g&&!E&&console.error(`<Turret> missing shape for barrel datablock: ${g}`),m[14]===Symbol.for("react.memo_cache_sentinel")?(l=(0,d.jsx)(rT,{}),m[14]=l):l=m[14],m[15]!==E||m[16]!==p?(u=E?(0,d.jsx)(rv,{type:"Turret",object:p,shapeName:E,children:(0,d.jsx)("group",{position:[0,1.5,0],children:(0,d.jsx)(rT,{})})}):null,m[15]=E,m[16]=p,m[17]=u):u=m[17],m[18]!==B||m[19]!==y||m[20]!==b||m[21]!==u?(c=(0,d.jsxs)("group",{position:B,quaternion:y,scale:b,children:[l,u]}),m[18]=B,m[19]=y,m[20]=b,m[21]=u,m[22]=c):c=m[22],m[23]!==p||m[24]!==x||m[25]!==c?(h=(0,d.jsx)(rv,{type:"Turret",object:p,shapeName:x,children:c}),m[23]=p,m[24]=x,m[25]=c,m[26]=h):h=m[26],h},WaterBlock:(0,h.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function(e){let t,r,n,i=(0,f.c)(7),{object:a}=e;i[0]!==a?(t=(0,eb.getPosition)(a),i[0]=a,i[1]=t):t=i[1];let o=t;i[2]!==a?(r=(0,eb.getProperty)(a,"name"),i[2]=a,i[3]=r):r=i[3];let s=r;return i[4]!==s||i[5]!==o?(n=s?(0,d.jsx)(tX.FloatingLabel,{position:o,opacity:.6,children:s}):null,i[4]=s,i[5]=o,i[6]=n):n=i[6],n}};function rj(e){let t,r,n,i=(0,f.c)(9),{object:a}=e,{missionType:o}=(0,h.useContext)(rP);i[0]!==a?(t=new Set(((0,eb.getProperty)(a,"missionTypesList")??"").toLowerCase().split(/s+/).filter(Boolean)),i[0]=a,i[1]=t):t=i[1];let s=t;i[2]!==o||i[3]!==s?(r=!s.size||s.has(o.toLowerCase()),i[2]=o,i[3]=s,i[4]=r):r=i[4];let l=r,u=rU[a._className];return i[5]!==u||i[6]!==a||i[7]!==l?(n=l&&u?(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(u,{object:a})}):null,i[5]=u,i[6]=a,i[7]=l,i[8]=n):n=i[8],n}var rN=e.i(86608),rJ=e.i(38433),rK=e.i(33870),rQ=e.i(91996);let rV=async e=>{let t;try{t=(0,eC.getUrlForPath)(e)}catch(t){return console.warn(`Script not in manifest: ${e} (${t})`),null}try{let r=await fetch(t);if(!r.ok)return console.error(`Script fetch failed: ${e} (${r.status})`),null;return await r.text()}catch(t){return console.error(`Script fetch error: ${e}`),console.error(t),null}},rq=(0,rK.createScriptCache)(),rX={findFiles:e=>{let t=(0,ev.default)(e,{nocase:!0});return(0,rQ.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,rQ.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,rQ.getResourceMap)()[(0,rQ.getResourceKey)(e)]},rW=(0,h.memo)(function(e){let t,r,n,i,a,o,s,l,u=(0,f.c)(17),{name:c,missionType:m,onLoadingChange:p}=e,{data:A}=((l=(0,f.c)(2))[0]!==c?(s={queryKey:["parsedMission",c],queryFn:()=>(0,eC.loadMission)(c)},l[0]=c,l[1]=s):s=l[1],eg(s,eo,void 0)),{missionGroup:g,runtime:v,progress:C}=function(e,t,r){let n,i,a,o=(0,f.c)(6);o[0]===Symbol.for("react.memo_cache_sentinel")?(n={missionGroup:void 0,runtime:void 0,progress:0},o[0]=n):n=o[0];let[s,l]=(0,h.useState)(n);return o[1]!==e||o[2]!==t||o[3]!==r?(i=()=>{if(!r)return;let n=new AbortController,i=(0,rJ.createProgressTracker)(),a=()=>{l(e=>({...e,progress:i.progress}))};i.on("update",a);let{runtime:o}=(0,rN.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:rV,fileSystem:rX,cache:rq,signal:n.signal,progress:i,ignoreScripts:["scripts/admin.cs","scripts/ai.cs","scripts/aiBotProfiles.cs","scripts/aiBountyGame.cs","scripts/aiChat.cs","scripts/aiCnH.cs","scripts/aiCTF.cs","scripts/aiDeathMatch.cs","scripts/aiDebug.cs","scripts/aiDefaultTasks.cs","scripts/aiDnD.cs","scripts/aiHumanTasks.cs","scripts/aiHunters.cs","scripts/aiInventory.cs","scripts/aiObjectiveBuilder.cs","scripts/aiObjectives.cs","scripts/aiRabbit.cs","scripts/aiSiege.cs","scripts/aiTDM.cs","scripts/aiTeamHunters.cs","scripts/deathMessages.cs","scripts/graphBuild.cs","scripts/navGraph.cs","scripts/serverTasks.cs","scripts/spdialog.cs"]},onMissionLoadDone:()=>{l({missionGroup:s.getObjectByName("MissionGroup"),runtime:s,progress:1})}}),s=o;return()=>{i.off("update",a),n.abort(),s.destroy()}},a=[e,t,r],o[1]=e,o[2]=t,o[3]=r,o[4]=i,o[5]=a):(i=o[4],a=o[5]),(0,h.useEffect)(i,a),s}(c,m,A),B=!A||!g||!v;u[0]!==g||u[1]!==m||u[2]!==A?(t={metadata:A,missionType:m,missionGroup:g},u[0]=g,u[1]=m,u[2]=A,u[3]=t):t=u[3];let y=t;return(u[4]!==B||u[5]!==p||u[6]!==C?(r=()=>{p?.(B,C)},n=[B,C,p],u[4]=B,u[5]=p,u[6]=C,u[7]=r,u[8]=n):(r=u[7],n=u[8]),(0,h.useEffect)(r,n),B)?null:(u[9]!==g?(i=(0,d.jsx)(rj,{object:g}),u[9]=g,u[10]=i):i=u[10],u[11]!==v||u[12]!==i?(a=(0,d.jsx)(eL.RuntimeProvider,{runtime:v,children:i}),u[11]=v,u[12]=i,u[13]=a):a=u[13],u[14]!==y||u[15]!==a?(o=(0,d.jsx)(rH,{value:y,children:a}),u[14]=y,u[15]=a,u[16]=o):o=u[16],o)});var rY=class extends x{constructor(e={}){super(),this.config=e,this.#H=new Map}#H;build(e,t,r){let n=t.queryKey,i=t.queryHash??L(n,t),a=this.get(i);return a||(a=new er({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#H.has(e.queryHash)||(this.#H.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#H.get(e.queryHash);t&&(e.destroy(),t===e&&this.#H.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){X.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#H.get(e)}getAll(){return[...this.#H.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>I(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>I(e,t)):t}notify(e){X.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){X.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){X.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rz=class extends et{#c;#k;#U;#d;constructor(e){super(),this.#c=e.client,this.mutationId=e.mutationId,this.#U=e.mutationCache,this.#k=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#k.includes(e)||(this.#k.push(e),this.clearGcTimeout(),this.#U.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#k=this.#k.filter(t=>t!==e),this.scheduleGc(),this.#U.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#k.length||("pending"===this.state.status?this.scheduleGc():this.#U.remove(this))}continue(){return this.#d?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#m({type:"continue"})},r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#d=ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#U.canRun(this)});let n="pending"===this.state.status,i=!this.#d.canStart();try{if(n)t();else{this.#m({type:"pending",variables:e,isPaused:i}),await this.#U.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#m({type:"pending",context:t,variables:e,isPaused:i})}let a=await this.#d.start();return await this.#U.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#U.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#m({type:"success",data:a}),a}catch(t){try{await this.#U.config.onError?.(t,e,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#U.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#m({type:"error",error:t}),t}finally{this.#U.runNext(this)}}#m(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),X.batch(()=>{this.#k.forEach(t=>{t.onMutationUpdate(e)}),this.#U.notify({mutation:this,type:"updated",action:e})})}},rZ=class extends x{constructor(e={}){super(),this.config=e,this.#j=new Set,this.#N=new Map,this.#J=0}#j;#N;#J;build(e,t,r){let n=new rz({client:e,mutationCache:this,mutationId:++this.#J,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#j.add(e);let t=r$(e);if("string"==typeof t){let r=this.#N.get(t);r?r.push(e):this.#N.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#j.delete(e)){let t=r$(e);if("string"==typeof t){let r=this.#N.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#N.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=r$(e);if("string"!=typeof t)return!0;{let r=this.#N.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=r$(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#N.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){X.batch(()=>{this.#j.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#j.clear(),this.#N.clear()})}getAll(){return Array.from(this.#j)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>G(t,e))}findAll(e={}){return this.getAll().filter(t=>G(e,t))}notify(e){X.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return X.batch(()=>Promise.all(e.map(e=>e.continue().catch(M))))}};function r$(e){return e.options.scope?.id}function r0(e){return{onFetch:(t,r)=>{let n=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=V(t.options,t.fetchOptions),c=async(e,n,i)=>{if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let a=(()=>{var e,a;let o,s,l={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta};return e=()=>t.signal,a=()=>r=!0,s=!1,Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(o??=e(),s||(s=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),l})(),o=await u(a),{maxPages:s}=t.options,l=i?K:J;return{pages:l(e.pages,o,s),pageParams:l(e.pageParams,n,s)}};if(i&&a.length){let e="backward"===i,t={pages:a,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:r1)(n,t);s=await c(t,r,e)}else{let t=e??a.length;do{let e=0===l?o[0]??n.initialPageParam:r1(n,s);if(l>0&&null==e)break;s=await c(s,e),l++}while(l<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function r1(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var r2=class{#K;#U;#f;#Q;#V;#q;#X;#W;constructor(e={}){this.#K=e.queryCache||new rY,this.#U=e.mutationCache||new rZ,this.#f=e.defaultOptions||{},this.#Q=new Map,this.#V=new Map,this.#q=0}mount(){this.#q++,1===this.#q&&(this.#X=q.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onFocus())}),this.#W=W.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onOnline())}))}unmount(){this.#q--,0===this.#q&&(this.#X?.(),this.#X=void 0,this.#W?.(),this.#W=void 0)}isFetching(e){return this.#K.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#U.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#K.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#K.build(this,t),n=r.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(w(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#K.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let n=this.defaultQueryOptions({queryKey:e}),i=this.#K.get(n.queryHash),a=i?.state.data,o="function"==typeof t?t(a):t;if(void 0!==o)return this.#K.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return X.batch(()=>this.#K.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#K.get(t.queryHash)?.state}removeQueries(e){let t=this.#K;X.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#K;return X.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(X.batch(()=>this.#K.findAll(e).map(e=>e.cancel(r)))).then(M).catch(M)}invalidateQueries(e,t={}){return X.batch(()=>(this.#K.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(X.batch(()=>this.#K.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(M)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(M)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#K.build(this,t);return r.isStaleByTime(w(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(M).catch(M)}fetchInfiniteQuery(e){return e.behavior=r0(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(M).catch(M)}ensureInfiniteQueryData(e){return e.behavior=r0(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return W.isOnline()?this.#U.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#K}getMutationCache(){return this.#U}getDefaultOptions(){return this.#f}setDefaultOptions(e){this.#f=e}setQueryDefaults(e,t){this.#Q.set(O(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#Q.values()],r={};return t.forEach(t=>{_(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#V.set(O(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#V.values()],r={};return t.forEach(t=>{_(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#f.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=L(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Q&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#f.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#K.clear(),this.#U.clear()}},r9=e.i(8155);let r3=e=>{let t=(0,r9.createStore)(e),r=e=>(function(e,t=e=>e){let r=h.default.useSyncExternalStore(e.subscribe,h.default.useCallback(()=>t(e.getState()),[e,t]),h.default.useCallback(()=>t(e.getInitialState()),[e,t]));return h.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},r5=h.createContext(null);function r8({map:e,children:t,onChange:r,domElement:n}){let i=e.map(e=>e.name+e.keys).join("-"),a=h.useMemo(()=>{let t,r;return t=()=>e.reduce((e,t)=>({...e,[t.name]:!1}),{}),(r=(e,r,n)=>{let i=n.subscribe;return n.subscribe=(e,t,r)=>{let a=e;if(t){let i=(null==r?void 0:r.equalityFn)||Object.is,o=e(n.getState());a=r=>{let n=e(r);if(!i(o,n)){let e=o;t(o=n,e)}},(null==r?void 0:r.fireImmediately)&&t(o,o)}return i(a)},t(e,r,n)})?r3(r):r3},[i]),o=h.useMemo(()=>[a.subscribe,a.getState,a],[i]),s=a.setState;return h.useEffect(()=>{let t=e.map(({name:e,keys:t,up:n})=>({keys:t,up:n,fn:t=>{s({[e]:t}),r&&r(e,t,o[1]())}})).reduce((e,{keys:t,fn:r,up:n=!0})=>(t.forEach(t=>e[t]={fn:r,pressed:!1,up:n}),e),{}),i=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,pressed:a,up:o}=n;n.pressed=!0,(o||!a)&&i(!0)},a=({key:e,code:r})=>{let n=t[e]||t[r];if(!n)return;let{fn:i,up:a}=n;n.pressed=!1,a&&i(!1)},l=n||window;return l.addEventListener("keydown",i,{passive:!0}),l.addEventListener("keyup",a,{passive:!0}),()=>{l.removeEventListener("keydown",i),l.removeEventListener("keyup",a)}},[n,i]),h.createElement(r5.Provider,{value:o,children:t})}var r4=Object.defineProperty;class r6{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?r4(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r})(this,"_listeners")}addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let t=0,n=r.length;t<n;t++)r[t].call(this,e);e.target=null}}}var r7=Object.defineProperty,ne=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?r7(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let nt=new A.Euler(0,0,0,"YXZ"),nr=new A.Vector3,nn={type:"change"},ni={type:"lock"},na={type:"unlock"},no=Math.PI/2;class ns extends r6{constructor(e,t){super(),ne(this,"camera"),ne(this,"domElement"),ne(this,"isLocked"),ne(this,"minPolarAngle"),ne(this,"maxPolarAngle"),ne(this,"pointerSpeed"),ne(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(nt.setFromQuaternion(this.camera.quaternion),nt.y-=.002*e.movementX*this.pointerSpeed,nt.x-=.002*e.movementY*this.pointerSpeed,nt.x=Math.max(no-this.maxPolarAngle,Math.min(no-this.minPolarAngle,nt.x)),this.camera.quaternion.setFromEuler(nt),this.dispatchEvent(nn))}),ne(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(ni),this.isLocked=!0):(this.dispatchEvent(na),this.isLocked=!1))}),ne(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),ne(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))}),ne(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))}),ne(this,"dispose",()=>{this.disconnect()}),ne(this,"getObject",()=>this.camera),ne(this,"direction",new A.Vector3(0,0,-1)),ne(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),ne(this,"moveForward",e=>{nr.setFromMatrixColumn(this.camera.matrix,0),nr.crossVectors(this.camera.up,nr),this.camera.position.addScaledVector(nr,e)}),ne(this,"moveRight",e=>{nr.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(nr,e)}),ne(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),ne(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)}}var nl=((c=nl||{}).forward="forward",c.backward="backward",c.left="left",c.right="right",c.up="up",c.down="down",c.camera1="camera1",c.camera2="camera2",c.camera3="camera3",c.camera4="camera4",c.camera5="camera5",c.camera6="camera6",c.camera7="camera7",c.camera8="camera8",c.camera9="camera9",c);let nu=Math.PI/2-.01;function nc(){let e,t,r,n,i,a,o,s,l,u,c,d,m=(0,f.c)(25),{speedMultiplier:p,setSpeedMultiplier:g}=(0,eM.useControls)(),[v,C]=function(e){let[t,r,n]=h.useContext(r5);return[t,r]}(),{camera:B,gl:y}=(0,ey.useThree)(),{nextCamera:b,setCameraIndex:x,cameraCount:E}=rO(),S=(0,h.useRef)(null);m[0]===Symbol.for("react.memo_cache_sentinel")?(e=new A.Vector3,m[0]=e):e=m[0];let F=(0,h.useRef)(e);m[1]===Symbol.for("react.memo_cache_sentinel")?(t=new A.Vector3,m[1]=t):t=m[1];let M=(0,h.useRef)(t);m[2]===Symbol.for("react.memo_cache_sentinel")?(r=new A.Vector3,m[2]=r):r=m[2];let T=(0,h.useRef)(r);return m[3]!==B||m[4]!==y.domElement?(n=()=>{let e=new ns(B,y.domElement);return S.current=e,()=>{e.dispose()}},i=[B,y.domElement],m[3]=B,m[4]=y.domElement,m[5]=n,m[6]=i):(n=m[5],i=m[6]),(0,h.useEffect)(n,i),m[7]!==B||m[8]!==y.domElement||m[9]!==b?(a=()=>{let e=y.domElement,t=new A.Euler(0,0,0,"YXZ"),r=!1,n=!1,i=0,a=0,o=t=>{S.current?.isLocked||t.target===e&&(r=!0,n=!1,i=t.clientX,a=t.clientY)},s=e=>{!r||!n&&3>Math.abs(e.clientX-i)&&3>Math.abs(e.clientY-a)||(n=!0,t.setFromQuaternion(B.quaternion,"YXZ"),t.y=t.y-.003*e.movementX,t.x=t.x-.003*e.movementY,t.x=Math.max(-nu,Math.min(nu,t.x)),B.quaternion.setFromEuler(t))},l=()=>{r=!1},u=t=>{let r=S.current;!r||r.isLocked?b():t.target!==e||n||r.lock()};return e.addEventListener("mousedown",o),document.addEventListener("mousemove",s),document.addEventListener("mouseup",l),document.addEventListener("click",u),()=>{e.removeEventListener("mousedown",o),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",l),document.removeEventListener("click",u)}},o=[B,y.domElement,b],m[7]=B,m[8]=y.domElement,m[9]=b,m[10]=a,m[11]=o):(a=m[10],o=m[11]),(0,h.useEffect)(a,o),m[12]!==E||m[13]!==x||m[14]!==v?(s=()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return v(t=>{for(let r=0;r<e.length;r++)if(t[e[r]]&&r<E){x(r);break}})},l=[v,x,E],m[12]=E,m[13]=x,m[14]=v,m[15]=s,m[16]=l):(s=m[15],l=m[16]),(0,h.useEffect)(s,l),m[17]!==y.domElement||m[18]!==g?(c=()=>{let e=e=>{e.preventDefault();let t=e.deltaY>0?-1:1,r=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*t;g(e=>Math.max(.1,Math.min(5,Math.round((e+r)*20)/20)))},t=y.domElement;return t.addEventListener("wheel",e,{passive:!1}),()=>{t.removeEventListener("wheel",e)}},u=[y.domElement,g],m[17]=y.domElement,m[18]=g,m[19]=u,m[20]=c):(u=m[19],c=m[20]),(0,h.useEffect)(c,u),m[21]!==B||m[22]!==C||m[23]!==p?(d=(e,t)=>{let{forward:r,backward:n,left:i,right:a,up:o,down:s}=C();if(!r&&!n&&!i&&!a&&!o&&!s)return;let l=80*p;B.getWorldDirection(F.current),F.current.normalize(),M.current.crossVectors(B.up,F.current).normalize(),T.current.set(0,0,0),r&&T.current.add(F.current),n&&T.current.sub(F.current),i&&T.current.add(M.current),a&&T.current.sub(M.current),o&&(T.current.y=T.current.y+1),s&&(T.current.y=T.current.y-1),T.current.lengthSq()>0&&(T.current.normalize().multiplyScalar(l*t),B.position.add(T.current))},m[21]=B,m[22]=C,m[23]=p,m[24]=d):d=m[24],(0,eB.useFrame)(d),null}let nd=[{name:"forward",keys:["KeyW"]},{name:"backward",keys:["KeyS"]},{name:"left",keys:["KeyA"]},{name:"right",keys:["KeyD"]},{name:"up",keys:["Space"]},{name:"down",keys:["ShiftLeft","ShiftRight"]},{name:"camera1",keys:["Digit1"]},{name:"camera2",keys:["Digit2"]},{name:"camera3",keys:["Digit3"]},{name:"camera4",keys:["Digit4"]},{name:"camera5",keys:["Digit5"]},{name:"camera6",keys:["Digit6"]},{name:"camera7",keys:["Digit7"]},{name:"camera8",keys:["Digit8"]},{name:"camera9",keys:["Digit9"]}];function nf(){let e,t,r=(0,f.c)(2);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],r[0]=e):e=r[0],(0,h.useEffect)(nh,e),r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,d.jsx)(r8,{map:nd,children:(0,d.jsx)(nc,{})}),r[1]=t):t=r[1],t}function nh(){return window.addEventListener("keydown",nm,{capture:!0}),window.addEventListener("keyup",nm,{capture:!0}),()=>{window.removeEventListener("keydown",nm,{capture:!0}),window.removeEventListener("keyup",nm,{capture:!0})}}function nm(e){(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()}let np=Math.PI/2-.01;function nA({joystickState:t,joystickZone:r}){return(0,h.useEffect)(()=>{let n=r.current;if(!n)return;let i=null,a=!1;return e.A(84968).then(e=>{a||((i=e.default.create({zone:n,mode:"static",position:{left:"70px",bottom:"70px"},size:120,restOpacity:.9})).on("move",(e,r)=>{t.current.angle=r.angle.radian,t.current.force=Math.min(1,r.force)}),i.on("end",()=>{t.current.force=0}))}),()=>{a=!0,i?.destroy()}},[t,r]),(0,d.jsx)("div",{ref:r,className:"TouchJoystick"})}function ng(e){let t,r,n,i,a,o,s,l,u,c,d=(0,f.c)(21),{joystickState:m,joystickZone:p}=e,{speedMultiplier:g}=(0,eM.useControls)(),{camera:v,gl:C}=(0,ey.useThree)();d[0]===Symbol.for("react.memo_cache_sentinel")?(t=new A.Euler(0,0,0,"YXZ"),d[0]=t):t=d[0];let B=(0,h.useRef)(t),y=(0,h.useRef)(null);d[1]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},d[1]=r):r=d[1];let b=(0,h.useRef)(r);d[2]===Symbol.for("react.memo_cache_sentinel")?(n=new A.Vector3,d[2]=n):n=d[2];let x=(0,h.useRef)(n);d[3]===Symbol.for("react.memo_cache_sentinel")?(i=new A.Vector3,d[3]=i):i=d[3];let E=(0,h.useRef)(i);d[4]===Symbol.for("react.memo_cache_sentinel")?(a=new A.Vector3,d[4]=a):a=d[4];let S=(0,h.useRef)(a);return d[5]!==v.quaternion?(o=()=>{B.current.setFromQuaternion(v.quaternion,"YXZ")},d[5]=v.quaternion,d[6]=o):o=d[6],d[7]!==v?(s=[v],d[7]=v,d[8]=s):s=d[8],(0,h.useEffect)(o,s),d[9]!==v.quaternion||d[10]!==C.domElement||d[11]!==p?(l=()=>{let e=C.domElement,t=e=>{let t=p.current;if(!t)return!1;let r=t.getBoundingClientRect();return e.clientX>=r.left&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom},r=e=>{if(null===y.current)for(let r=0;r<e.changedTouches.length;r++){let n=e.changedTouches[r];if(!t(n)){y.current=n.identifier,b.current={x:n.clientX,y:n.clientY};break}}},n=e=>{if(null!==y.current)for(let t=0;t<e.changedTouches.length;t++){let r=e.changedTouches[t];if(r.identifier===y.current){let e=r.clientX-b.current.x,t=r.clientY-b.current.y;b.current={x:r.clientX,y:r.clientY},B.current.setFromQuaternion(v.quaternion,"YXZ"),B.current.y=B.current.y-.004*e,B.current.x=B.current.x-.004*t,B.current.x=Math.max(-np,Math.min(np,B.current.x)),v.quaternion.setFromEuler(B.current);break}}},i=e=>{for(let t=0;t<e.changedTouches.length;t++)if(e.changedTouches[t].identifier===y.current){y.current=null;break}};return e.addEventListener("touchstart",r,{passive:!0}),e.addEventListener("touchmove",n,{passive:!0}),e.addEventListener("touchend",i,{passive:!0}),e.addEventListener("touchcancel",i,{passive:!0}),()=>{e.removeEventListener("touchstart",r),e.removeEventListener("touchmove",n),e.removeEventListener("touchend",i),e.removeEventListener("touchcancel",i)}},d[9]=v.quaternion,d[10]=C.domElement,d[11]=p,d[12]=l):l=d[12],d[13]!==v||d[14]!==C.domElement||d[15]!==p?(u=[v,C.domElement,p],d[13]=v,d[14]=C.domElement,d[15]=p,d[16]=u):u=d[16],(0,h.useEffect)(l,u),d[17]!==v||d[18]!==m.current||d[19]!==g?(c=(e,t)=>{let{force:r,angle:n}=m.current;if(0===r)return;let i=80*g*r,a=Math.cos(n),o=Math.sin(n);v.getWorldDirection(x.current),x.current.normalize(),E.current.crossVectors(v.up,x.current).normalize(),S.current.set(0,0,0).addScaledVector(x.current,o).addScaledVector(E.current,-a),S.current.lengthSq()>0&&(S.current.normalize().multiplyScalar(i*t),v.position.add(S.current))},d[17]=v,d[18]=m.current,d[19]=g,d[20]=c):c=d[20],(0,eB.useFrame)(c),null}var nv="undefined"!=typeof window&&!!(null==(u=window.document)?void 0:u.createElement);function nC(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function nB(e){return e?"self"in e?e.self:nC(e).defaultView||window:self}function ny(e,t=!1){let{activeElement:r}=nC(e);if(!(null==r?void 0:r.nodeName))return null;if(nx(r)&&r.contentDocument)return ny(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=nC(r).getElementById(e);if(t)return t}}return r}function nb(e,t){return e===t||e.contains(t)}function nx(e){return"IFRAME"===e.tagName}function nE(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==nS.indexOf(e.type)}var nS=["button","color","file","image","reset","submit"];function nF(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function nM(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function nT(e){return e.isContentEditable||nM(e)}function nR(e){let t=0,r=0;if(nM(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=nC(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&nb(e,n.anchorNode)&&n.focusNode&&nb(e,n.focusNode)){let i=n.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),a.setEnd(i.startContainer,i.startOffset),t=a.toString().length,a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}}return{start:t,end:r}}function nw(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function nD(e){if(!e)return null;let t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){let{overflowY:r}=getComputedStyle(e);if(t(r))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){let{overflowX:r}=getComputedStyle(e);if(t(r))return e}return nD(e.parentElement)||document.scrollingElement||document.body}function nI(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function nG(e,t){return t&&e.item(t)||null}var nL=Symbol("FOCUS_SILENTLY");function nO(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function n_(){}function nP(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nH(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function nk(e){return e}function nU(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function nj(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function nN(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function nJ(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function nK(...e){for(let t of e)if(void 0!==t)return t}function nQ(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function nV(){return nv&&!!navigator.maxTouchPoints}function nq(){return!!nv&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function nX(){return nv&&nq()&&/apple/i.test(navigator.vendor)}function nW(e){return!!(e.currentTarget&&!nb(e.currentTarget,e.target))}function nY(e){return e.target===e.currentTarget}function nz(e,t){let r=new FocusEvent("blur",t),n=e.dispatchEvent(r),i={...t,bubbles:!0};return e.dispatchEvent(new FocusEvent("focusout",i)),n}function nZ(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function n$(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!nb(r,n)}function n0(e,t,r,n){let i=(e=>{if(n){let t=setTimeout(e,n);return()=>clearTimeout(t)}let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),r()}),a=()=>{i(),r()};return e.addEventListener(t,a,{once:!0,capture:!0}),i}function n1(e,t,r,n=window){let i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(n1(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var n2={...h},n9=n2.useId;n2.useDeferredValue;var n3=n2.useInsertionEffect,n5=nv?h.useLayoutEffect:h.useEffect;function n8(e){let t=(0,h.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return n3?n3(()=>{t.current=e}):t.current=e,(0,h.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function n4(...e){return(0,h.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)nQ(r,t)}},e)}function n6(e){if(n9){let t=n9();return e||t}let[t,r]=(0,h.useState)(e);return n5(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function n7(e,t){let r=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,h.useEffect)(()=>()=>{r.current=!1},[])}function ie(){return(0,h.useReducer)(()=>[],[])}function it(e){return n8("function"==typeof e?e:()=>e)}function ir(e,t,r=[]){let n=(0,h.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function ii(e=!1,t){let[r,n]=(0,h.useState)(null);return{portalRef:n4(n,t),portalNode:r,domReady:!e||r}}var ia=!1,io=!1,is=0,il=0;function iu(e){let t,r;t=e.movementX||e.screenX-is,r=e.movementY||e.screenY-il,is=e.screenX,il=e.screenY,(t||r||0)&&(io=!0)}function ic(){io=!1}function id(e){let t=h.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function ih(e,t){return h.memo(e,t)}function im(e,t){let r,{wrapElement:n,render:i,...a}=t,o=n4(t.ref,i&&(0,h.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(h.isValidElement(i)){let e={...i.props,ref:o};r=h.cloneElement(i,function(e,t){let r={...e};for(let n in t){if(!nP(t,n))continue;if("className"===n){let n="className";r[n]=e[n]?`${e[n]} ${t[n]}`:t[n];continue}if("style"===n){let n="style";r[n]=e[n]?{...e[n],...t[n]}:t[n];continue}let i=t[n];if("function"==typeof i&&n.startsWith("on")){let t=e[n];if("function"==typeof t){r[n]=(...e)=>{i(...e),t(...e)};continue}}r[n]=i}return r}(a,e))}else r=i?i(a):(0,d.jsx)(e,{...a});return n?n(r):r}function ip(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function iA(e=[],t=[]){let r=h.createContext(void 0),n=h.createContext(void 0),i=()=>h.useContext(r),a=t=>e.reduceRight((e,r)=>(0,d.jsx)(r,{...t,children:e}),(0,d.jsx)(r.Provider,{...t}));return{context:r,scopedContext:n,useContext:i,useScopedContext:(e=!1)=>{let t=h.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=h.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:a,ScopedContextProvider:e=>(0,d.jsx)(a,{...e,children:t.reduceRight((t,r)=>(0,d.jsx)(r,{...e,children:t}),(0,d.jsx)(n.Provider,{...e}))})}}var ig=iA(),iv=ig.useContext;ig.useScopedContext,ig.useProviderContext;var iC=iA([ig.ContextProvider],[ig.ScopedContextProvider]),iB=iC.useContext;iC.useScopedContext;var iy=iC.useProviderContext,ib=iC.ContextProvider,ix=iC.ScopedContextProvider,iE=(0,h.createContext)(void 0),iS=(0,h.createContext)(void 0),iF=(0,h.createContext)(!0),iM="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 iT(e){return!(!e.matches(iM)||!nF(e)||e.closest("[inert]"))}function iR(e){if(!iT(e)||0>Number.parseInt(e.getAttribute("tabindex")||"0",10))return!1;if(!("form"in e)||!e.form||e.checked||"radio"!==e.type)return!0;let t=e.form.elements.namedItem(e.name);if(!t||!("length"in t))return!0;let r=ny(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function iw(e,t){let r=Array.from(e.querySelectorAll(iM));t&&r.unshift(e);let n=r.filter(iT);return n.forEach((e,t)=>{if(nx(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...iw(r))}}),n}function iD(e,t,r){let n=Array.from(e.querySelectorAll(iM)),i=n.filter(iR);return(t&&iR(e)&&i.unshift(e),i.forEach((e,t)=>{if(nx(e)&&e.contentDocument){let n=iD(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function iI(e,t){var r;let n,i,a,o;return r=document.body,n=ny(r),a=(i=iw(r,!1)).indexOf(n),(o=i.slice(a+1)).find(iR)||(e?i.find(iR):null)||(t?o[0]:null)||null}function iG(e,t){var r;let n,i,a,o;return r=document.body,n=ny(r),a=(i=iw(r,!1).reverse()).indexOf(n),(o=i.slice(a+1)).find(iR)||(e?i.find(iR):null)||(t?o[0]:null)||null}function iL(e){let t=ny(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function iO(e){let t=ny(e);if(!t)return!1;if(nb(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function i_(e){!iO(e)&&iT(e)&&e.focus()}var iP=nX(),iH=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],ik=Symbol("safariFocusAncestor");function iU(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function ij(e,t){return n8(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var iN=!1,iJ=!0;function iK(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(iJ=!1)}function iQ(e){e.metaKey||e.ctrlKey||e.altKey||(iJ=!0)}var iV=ip(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var a,o,s,l,u;let c=(0,h.useRef)(null);(0,h.useEffect)(()=>{!e||iN||(n1("mousedown",iK,!0),n1("keydown",iQ,!0),iN=!0)},[e]),iP&&(0,h.useEffect)(()=>{if(!e)return;let t=c.current;if(!t||!iU(t))return;let r="labels"in t?t.labels:null;if(!r)return;let n=()=>queueMicrotask(()=>t.focus());for(let e of r)e.addEventListener("mouseup",n);return()=>{for(let e of r)e.removeEventListener("mouseup",n)}},[e]);let d=e&&nN(i),f=!!d&&!t,[m,p]=(0,h.useState)(!1);(0,h.useEffect)(()=>{e&&f&&m&&p(!1)},[e,f,m]),(0,h.useEffect)(()=>{if(!e||!m)return;let t=c.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{iT(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,m]);let A=ij(i.onKeyPressCapture,d),g=ij(i.onMouseDownCapture,d),v=ij(i.onClickCapture,d),C=i.onMouseDown,B=n8(t=>{if(null==C||C(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!iP||nW(t)||!nE(r)&&!iU(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let a=function(e){for(;e&&!iT(e);)e=e.closest(iM);return e||null}(r.parentElement);a&&(a[ik]=!0),n0(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),a&&(a[ik]=!1),n||i_(r)})}),y=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&iL(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",p(!0)))},b=i.onKeyDownCapture,x=n8(t=>{if(null==b||b(t),t.defaultPrevented||!e||m||t.metaKey||t.altKey||t.ctrlKey||!nY(t))return;let r=t.currentTarget;n0(r,"focusout",()=>y(t,r))}),E=i.onFocusCapture,S=n8(t=>{if(null==E||E(t),t.defaultPrevented||!e)return;if(!nY(t))return void p(!1);let r=t.currentTarget;iJ||function(e){let{tagName:t,readOnly:r,type:n}=e;return"TEXTAREA"===t&&!r||"SELECT"===t&&!r||("INPUT"!==t||r?!!e.isContentEditable||"combobox"===e.getAttribute("role")&&!!e.dataset.name:iH.includes(n))}(t.target)?n0(t.target,"focusout",()=>y(t,r)):p(!1)}),F=i.onBlur,M=n8(t=>{null==F||F(t),!e||n$(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),T=(0,h.useContext)(iF),R=n8(t=>{e&&r&&t&&T&&queueMicrotask(()=>{iL(t)||iT(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,h.useState)(()=>r(void 0));return n5(()=>{let t=e&&"current"in e?e.current:e;i((null==t?void 0:t.tagName.toLowerCase())||r(void 0))},[e,void 0]),n}(c),D=e&&(!w||"button"===w||"summary"===w||"input"===w||"select"===w||"textarea"===w||"a"===w),I=e&&(!w||"button"===w||"input"===w||"select"===w||"textarea"===w),G=i.style,L=(0,h.useMemo)(()=>f?{pointerEvents:"none",...G}:G,[f,G]);return i={"data-focus-visible":e&&m||void 0,"data-autofocus":r||void 0,"aria-disabled":d||void 0,...i,ref:n4(c,R,i.ref),style:L,tabIndex:(a=e,o=f,s=D,l=I,u=i.tabIndex,a?o?s&&!l?-1:void 0:s?u:u||0:u),disabled:!!I&&!!f||void 0,contentEditable:d?void 0:i.contentEditable,onKeyPressCapture:A,onClickCapture:v,onMouseDownCapture:g,onMouseDown:B,onKeyDownCapture:x,onFocusCapture:S,onBlur:M},nJ(i)});function iq(e){let t=[];for(let r of e)t.push(...r);return t}function iX(e){return e.slice().reverse()}function iW(e,t,r){return n8(n=>{var i;let a,o;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!nY(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(a=n.target)||nM(a))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let s=e.getState(),l=null==(i=nG(e,s.activeId))?void 0:i.element;if(!l)return;let{view:u,...c}=n;l!==(null==r?void 0:r.current)&&l.focus(),o=new KeyboardEvent(n.type,c),l.dispatchEvent(o)||n.preventDefault(),n.currentTarget.contains(l)&&n.stopPropagation()})}id(function(e){return im("div",iV(e))});var iY=ip(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...i}){let a=iy();nU(e=e||a,!1);let o=(0,h.useRef)(null),s=(0,h.useRef)(null),l=function(e){let[t,r]=(0,h.useState)(!1),n=(0,h.useCallback)(()=>r(!0),[]),i=e.useState(t=>nG(e,t.activeId));return(0,h.useEffect)(()=>{let e=null==i?void 0:i.element;!t||e&&(r(!1),e.focus({preventScroll:!0}))},[i,t]),n}(e),u=e.useState("moves"),[,c]=function(e){let[t,r]=(0,h.useState)(null);return n5(()=>{if(null==t||!e)return;let r=null;return e(e=>(r=e,t)),()=>{e(r)}},[t,e]),[t,r]}(t?e.setBaseElement:null);(0,h.useEffect)(()=>{var n;if(!e||!u||!t||!r)return;let{activeId:i}=e.getState(),a=null==(n=nG(e,i))?void 0:n.element;a&&("scrollIntoView"in a?(a.focus({preventScroll:!0}),a.scrollIntoView({block:"nearest",inline:"nearest",...void 0})):a.focus())},[e,u,t,r]),n5(()=>{if(!e||!u||!t)return;let{baseElement:r,activeId:n}=e.getState();if(null!==n||!r)return;let i=s.current;s.current=null,i&&nz(i,{relatedTarget:r}),iL(r)||r.focus()},[e,u,t]);let f=e.useState("activeId"),m=e.useState("virtualFocus");n5(()=>{var r;if(!e||!t||!m)return;let n=s.current;if(s.current=null,!n)return;let i=(null==(r=nG(e,f))?void 0:r.element)||ny(n);i!==n&&nz(n,{relatedTarget:i})},[e,f,m,t]);let p=iW(e,i.onKeyDownCapture,s),A=iW(e,i.onKeyUpCapture,s),g=i.onFocusCapture,v=n8(t=>{var r;let n;if(null==g||g(t),t.defaultPrevented||!e)return;let{virtualFocus:i}=e.getState();if(!i)return;let a=t.relatedTarget,o=(n=(r=t.currentTarget)[nL],delete r[nL],n);nY(t)&&o&&(t.stopPropagation(),s.current=a)}),C=i.onFocus,B=n8(r=>{if(null==C||C(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?nY(r)&&!nO(e,n)&&queueMicrotask(l):nY(r)&&e.setActiveId(null)}),y=i.onBlurCapture,b=n8(t=>{var r;if(null==y||y(t),t.defaultPrevented||!e)return;let{virtualFocus:n,activeId:i}=e.getState();if(!n)return;let a=null==(r=nG(e,i))?void 0:r.element,o=t.relatedTarget,l=nO(e,o),u=s.current;s.current=null,nY(t)&&l?(o===a?u&&u!==o&&nz(u,t):a?nz(a,t):u&&nz(u,t),t.stopPropagation()):!nO(e,t.target)&&a&&nz(a,t)}),x=i.onKeyDown,E=it(n),S=n8(t=>{var r;if(null==x||x(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!nY(t))return;let{orientation:n,renderedItems:i,activeId:a}=e.getState(),o=nG(e,a);if(null==(r=null==o?void 0:o.element)?void 0:r.isConnected)return;let s="horizontal"!==n,l="vertical"!==n,u=i.some(e=>!!e.rowId);if(("ArrowLeft"===t.key||"ArrowRight"===t.key||"Home"===t.key||"End"===t.key)&&nM(t.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=iq(iX(function(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}(i))).find(e=>!e.disabled);return null==e?void 0:e.id}return null==e?void 0:e.last()}),ArrowRight:(u||l)&&e.first,ArrowDown:(u||s)&&e.first,ArrowLeft:(u||l)&&e.last,Home:e.first,End:e.last,PageUp:e.first,PageDown:e.last}[t.key];if(c){let r=c();if(void 0!==r){if(!E(t))return;t.preventDefault(),e.move(r)}}});return i=ir(i,t=>(0,d.jsx)(ib,{value:e,children:t}),[e]),i={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=nG(e,r.activeId))?void 0:n.id}),...i,ref:n4(o,c,i.ref),onKeyDownCapture:p,onKeyUpCapture:A,onFocusCapture:v,onFocus:B,onBlurCapture:b,onKeyDown:S},i=iV({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...i})});id(function(e){return im("div",iY(e))});var iz=iA();iz.useContext,iz.useScopedContext;var iZ=iz.useProviderContext,i$=iA([iz.ContextProvider],[iz.ScopedContextProvider]);i$.useContext,i$.useScopedContext;var i0=i$.useProviderContext,i1=i$.ContextProvider,i2=i$.ScopedContextProvider,i9=(0,h.createContext)(void 0),i3=(0,h.createContext)(void 0),i5=iA([i1],[i2]);i5.useContext,i5.useScopedContext;var i8=i5.useProviderContext,i4=i5.ContextProvider,i6=i5.ScopedContextProvider,i7=ip(function({store:e,...t}){let r=i8();return e=e||r,t={...t,ref:n4(null==e?void 0:e.setAnchorElement,t.ref)}});id(function(e){return im("div",i7(e))});var ae=(0,h.createContext)(void 0),at=iA([i4,ib],[i6,ix]),ar=at.useContext,an=at.useScopedContext,ai=at.useProviderContext,aa=at.ContextProvider,ao=at.ScopedContextProvider,as=(0,h.createContext)(void 0),al=(0,h.createContext)(!1);function au(e,t){let r=e.__unstableInternals;return nU(r,"Invalid store"),r[t]}function ac(e,...t){let r=e,n=r,i=Symbol(),a=n_,o=new Set,s=new Set,l=new Set,u=new Set,c=new Set,d=new WeakMap,f=new WeakMap,h=(e,t,r=u)=>(r.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),r.delete(t)}),m=(e,a,o=!1)=>{var l,h;if(!nP(r,e))return;let m=(h=r[e],"function"==typeof a?a("function"==typeof h?h():h):a);if(m===r[e])return;if(!o)for(let r of t)null==(l=null==r?void 0:r.setState)||l.call(r,e,m);let p=r;r={...r,[e]:m};let A=Symbol();i=A,s.add(e);let g=(t,n,i)=>{var a;let o=f.get(t);(!o||o.some(t=>i?i.has(t):t===e))&&(null==(a=d.get(t))||a(),d.set(t,t(r,n)))};for(let e of u)g(e,p);queueMicrotask(()=>{if(i!==A)return;let e=r;for(let e of c)g(e,n,s);n=e,s.clear()})},p={getState:()=>r,setState:m,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{let e=o.size,n=Symbol();o.add(n);let i=()=>{o.delete(n),o.size||a()};if(e)return i;let s=Object.keys(r).map(e=>nH(...t.map(t=>{var r;let n=null==(r=null==t?void 0:t.getState)?void 0:r.call(t);if(n&&nP(n,e))return am(t,[e],t=>{m(e,t[e],!0)})}))),u=[];for(let e of l)u.push(e());return a=nH(...s,...u,...t.map(af)),i},subscribe:(e,t)=>h(e,t),sync:(e,t)=>(d.set(t,t(r,r)),h(e,t)),batch:(e,t)=>(d.set(t,t(r,n)),h(e,t,c)),pick:e=>ac(function(e,t){let r={};for(let n of t)nP(e,n)&&(r[n]=e[n]);return r}(r,e),p),omit:e=>ac(function(e,t){let r={...e};for(let e of t)nP(r,e)&&delete r[e];return r}(r,e),p)}};return p}function ad(e,...t){if(e)return au(e,"setup")(...t)}function af(e,...t){if(e)return au(e,"init")(...t)}function ah(e,...t){if(e)return au(e,"subscribe")(...t)}function am(e,...t){if(e)return au(e,"sync")(...t)}function ap(e,...t){if(e)return au(e,"batch")(...t)}function aA(e,...t){if(e)return au(e,"omit")(...t)}function ag(...e){var t;let r={};for(let n of e){let e=null==(t=null==n?void 0:n.getState)?void 0:t.call(n);e&&Object.assign(r,e)}let n=ac(r,...e);return Object.assign({},...e,n)}function av(e,t){}function aC(e,t,r){if(!r)return!1;let n=e.find(e=>!e.disabled&&e.value);return(null==n?void 0:n.value)===t}function aB(e,t){return!!t&&null!=e&&(e=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}var ay=ip(function({store:e,focusable:t=!0,autoSelect:r=!1,getAutoSelectId:n,setValueOnChange:i,showMinLength:a=0,showOnChange:o,showOnMouseDown:s,showOnClick:l=s,showOnKeyDown:u,showOnKeyPress:c=u,blurActiveItemOnClick:d,setValueOnClick:f=!0,moveOnKeyPress:m=!0,autoComplete:p="list",...A}){var g;let v,C=ai();nU(e=e||C,!1);let B=(0,h.useRef)(null),[y,b]=ie(),x=(0,h.useRef)(!1),E=(0,h.useRef)(!1),S=e.useState(e=>e.virtualFocus&&r),F="inline"===p||"both"===p,[M,T]=(0,h.useState)(F);g=[F],v=(0,h.useRef)(!1),n5(()=>{if(v.current)return(()=>{F&&T(!0)})();v.current=!0},g),n5(()=>()=>{v.current=!1},[]);let R=e.useState("value"),w=(0,h.useRef)();(0,h.useEffect)(()=>am(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let D=e.useState(e=>{var t;if(F&&M){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=e.useState("renderedItems"),G=e.useState("open"),L=e.useState("contentElement"),O=(0,h.useMemo)(()=>{if(!F||!M)return R;if(aC(I,D,S)){if(aB(R,D)){let e=(null==D?void 0:D.slice(R.length))||"";return R+e}return R}return D||R},[F,M,I,D,S,R]);(0,h.useEffect)(()=>{let e=B.current;if(!e)return;let t=()=>T(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,h.useEffect)(()=>{if(!F||!M||!D||!aC(I,D,S)||!aB(R,D))return;let e=n_;return queueMicrotask(()=>{let t=B.current;if(!t)return;let{start:r,end:n}=nR(t),i=R.length,a=D.length;nI(t,i,a),e=()=>{if(!iL(t))return;let{start:e,end:o}=nR(t);e!==i||o===a&&nI(t,r,n)}}),()=>e()},[y,F,M,D,I,S,R]);let _=(0,h.useRef)(null),P=n8(n),H=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(!G||!L)return;let t=nD(L);if(!t)return;_.current=t;let r=()=>{x.current=!1},n=()=>{if(!e||!x.current)return;let{activeId:t}=e.getState();null===t||t!==H.current&&(x.current=!1)},i={passive:!0,capture:!0};return t.addEventListener("wheel",r,i),t.addEventListener("touchmove",r,i),t.addEventListener("scroll",n,i),()=>{t.removeEventListener("wheel",r,!0),t.removeEventListener("touchmove",r,!0),t.removeEventListener("scroll",n,!0)}},[G,L,e]),n5(()=>{!R||E.current||(x.current=!0)},[R]),n5(()=>{"always"!==S&&G||(x.current=G)},[S,G]);let k=e.useState("resetValueOnSelect");n7(()=>{var t,r;let n=x.current;if(!e||!G||!n&&!k)return;let{baseElement:i,contentElement:a,activeId:o}=e.getState();if(!i||iL(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(b);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(S&&n){let r,n=P(I),i=void 0!==n?n:null!=(t=null==(r=I.find(e=>{var t;return!e.disabled&&(null==(t=e.element)?void 0:t.getAttribute("role"))!=="tab"}))?void 0:r.id)?t:e.first();H.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,G,y,R,S,k,P,I]),(0,h.useEffect)(()=>{if(!F)return;let t=B.current;if(!t)return;let r=[t,L].filter(e=>!!e),n=t=>{r.every(e=>n$(t,e))&&(null==e||e.setValue(O))};for(let e of r)e.addEventListener("focusout",n);return()=>{for(let e of r)e.removeEventListener("focusout",n)}},[F,L,e,O]);let U=e=>e.currentTarget.value.length>=a,j=A.onChange,N=it(null!=o?o:U),J=it(null!=i?i:!e.tag),K=n8(t=>{if(null==j||j(t),t.defaultPrevented||!e)return;let r=t.currentTarget,{value:n,selectionStart:i,selectionEnd:a}=r,o=t.nativeEvent;if(x.current=!0,"input"===o.type&&(o.isComposing&&(x.current=!1,E.current=!0),F)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;T(e&&t)}if(J(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{nI(r,i,a)}),F&&S&&t&&b()}N(t)&&e.show(),S&&x.current||e.setActiveId(null)}),Q=A.onCompositionEnd,V=n8(e=>{x.current=!0,E.current=!1,null==Q||Q(e),e.defaultPrevented||S&&b()}),q=A.onMouseDown,X=it(null!=d?d:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=it(f),Y=it(null!=l?l:U),z=n8(t=>{null==q||q(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(X(t)&&e.setActiveId(null),W(t)&&e.setValue(O),Y(t)&&n0(t.currentTarget,"mouseup",e.show))}),Z=A.onKeyDown,$=it(null!=c?c:U),ee=n8(t=>{if(null==Z||Z(t),t.repeat||(x.current=!1),t.defaultPrevented||t.ctrlKey||t.altKey||t.shiftKey||t.metaKey||!e)return;let{open:r}=e.getState();!r&&("ArrowUp"===t.key||"ArrowDown"===t.key)&&$(t)&&(t.preventDefault(),e.show())}),et=A.onBlur,er=n8(e=>{if(x.current=!1,null==et||et(e),e.defaultPrevented)return}),en=n6(A.id),ei=e.useState(e=>null===e.activeId);return A={id:en,role:"combobox","aria-autocomplete":"inline"===p||"list"===p||"both"===p||"none"===p?p:void 0,"aria-haspopup":nw(L,"listbox"),"aria-expanded":G,"aria-controls":null==L?void 0:L.id,"data-active-item":ei||void 0,value:O,...A,ref:n4(B,A.ref),onChange:K,onCompositionEnd:V,onMouseDown:z,onKeyDown:ee,onBlur:er},A=iY({store:e,focusable:t,...A,moveOnKeyPress:e=>!nj(m,e)&&(F&&T(!0),!0)}),{autoComplete:"off",...A=i7({store:e,...A})}}),ab=id(function(e){return im("input",ay(e))});function ax(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var aE=Symbol("composite-hover"),aS=ip(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=iB();nU(e=e||i,!1);let a=((0,h.useEffect)(()=>{ia||(n1("mousemove",iu,!0),n1("mousedown",ic,!0),n1("mouseup",ic,!0),n1("keydown",ic,!0),n1("scroll",ic,!0),ia=!0)},[]),n8(()=>io)),o=n.onMouseMove,s=it(t),l=n8(t=>{if((null==o||o(t),!t.defaultPrevented&&a())&&s(t)){if(!iO(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!iL(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),u=n.onMouseLeave,c=it(r),d=n8(t=>{var r;let n;null==u||u(t),!t.defaultPrevented&&a()&&((n=ax(t))&&nb(t.currentTarget,n)||function(e){let t=ax(e);if(!t)return!1;do{if(nP(t,aE)&&t[aE])return!0;t=t.parentElement}while(t)return!1}(t)||!s(t)||c(t)&&(null==e||e.setActiveId(null),null==(r=null==e?void 0:e.getState().baseElement)||r.focus()))}),f=(0,h.useCallback)(e=>{e&&(e[aE]=!0)},[]);return nJ(n={...n,ref:n4(f,n.ref),onMouseMove:l,onMouseLeave:d})});ih(id(function(e){return im("div",aS(e))}));var aF=ip(function({store:e,shouldRegisterItem:t=!0,getItem:r=nk,element:n,...i}){let a=iv();e=e||a;let o=n6(i.id),s=(0,h.useRef)(n);return(0,h.useEffect)(()=>{let n=s.current;if(!o||!n||!t)return;let i=r({id:o,element:n});return null==e?void 0:e.renderItem(i)},[o,t,r,e]),nJ(i={...i,ref:n4(s,i.ref)})});function aM(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?nE(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(nE(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}id(function(e){return im("div",aF(e))});var aT=Symbol("command"),aR=ip(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let n,i,a=(0,h.useRef)(null),[o,s]=(0,h.useState)(!1);(0,h.useEffect)(()=>{a.current&&s(nE(a.current))},[]);let[l,u]=(0,h.useState)(!1),c=(0,h.useRef)(!1),d=nN(r),[f,m]=(n=r.onLoadedMetadataCapture,i=(0,h.useMemo)(()=>Object.assign(()=>{},{...n,[aT]:!0}),[n,aT,!0]),[null==n?void 0:n[aT],{onLoadedMetadataCapture:i}]),p=r.onKeyDown,A=n8(r=>{null==p||p(r);let n=r.currentTarget;if(r.defaultPrevented||f||d||!nY(r)||nM(n)||n.isContentEditable)return;let i=e&&"Enter"===r.key,a=t&&" "===r.key,o="Enter"===r.key&&!e,s=" "===r.key&&!t;if(o||s)return void r.preventDefault();if(i||a){let e=aM(r);if(i){if(!e){r.preventDefault();let{view:e,...t}=r,i=()=>nZ(n,t);nv&&/firefox\//i.test(navigator.userAgent)?n0(n,"keyup",i):queueMicrotask(i)}}else a&&(c.current=!0,e||(r.preventDefault(),u(!0)))}}),g=r.onKeyUp,v=n8(e=>{if(null==g||g(e),e.defaultPrevented||f||d||e.metaKey)return;let r=t&&" "===e.key;if(c.current&&r&&(c.current=!1,!aM(e))){e.preventDefault(),u(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>nZ(t,n))}});return iV(r={"data-active":l||void 0,type:o?"button":void 0,...m,...r,ref:n4(a,r.ref),onKeyDown:A,onKeyUp:v})});id(function(e){return im("button",aR(e))});var{useSyncExternalStore:aw}=e.i(2239).default,aD=()=>()=>{};function aI(e,t=nk){let r=h.useCallback(t=>e?ah(e,null,t):aD(),[e]),n=()=>{let r="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&r&&nP(i,r)?i[r]:void 0};return aw(r,n,n)}function aG(e,t){let r=h.useRef({}),n=h.useCallback(t=>e?ah(e,null,t):aD(),[e]),i=()=>{let n=null==e?void 0:e.getState(),i=!1,a=r.current;for(let e in t){let r=t[e];if("function"==typeof r){let t=r(n);t!==a[e]&&(a[e]=t,i=!0)}if("string"==typeof r){if(!n||!nP(n,r))continue;let t=n[r];t!==a[e]&&(a[e]=t,i=!0)}}return i&&(r.current={...a}),r.current};return aw(n,i,i)}function aL(e,t,r,n){var i;let a,o=nP(t,r)?t[r]:void 0,s=(i={value:o,setValue:n?t[n]:void 0},a=(0,h.useRef)(i),n5(()=>{a.current=i}),a);n5(()=>am(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),n5(()=>{if(void 0!==o)return e.setState(r,o),ap(e,[r],()=>{void 0!==o&&e.setState(r,o)})})}function aO(e,t){let[r,n]=h.useState(()=>e(t));n5(()=>af(r),[r]);let i=h.useCallback(e=>aI(r,e),[r]);return[h.useMemo(()=>({...r,useState:i}),[r,i]),n8(()=>{n(r=>e({...t,...r.getState()}))})]}function a_(e,t,r,n=!1){var i;let a,o;if(!t||!r)return;let{renderedItems:s}=t.getState(),l=nD(e);if(!l)return;let u=function(e,t=!1){let r=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*r,r-40),a=t?r-i+n:i+n;return"HTML"===e.tagName?a+e.scrollTop:a}(l,n);for(let e=0;e<s.length;e+=1){let s=a;if(!(a=r(e)))break;if(a===s)continue;let l=null==(i=nG(t,a))?void 0:i.element;if(!l)continue;let c=function(e,t=!1){let{top:r}=e.getBoundingClientRect();return t?r+e.clientHeight:r}(l,n)-u,d=Math.abs(c);if(n&&c<=0||!n&&c>=0){void 0!==o&&o<d&&(a=s);break}o=d}return a}var aP=ip(function({store:e,rowId:t,preventScrollOnKeyDown:r=!1,moveOnKeyPress:n=!0,tabbable:i=!1,getItem:a,"aria-setsize":o,"aria-posinset":s,...l}){let u=iB();e=e||u;let c=n6(l.id),f=(0,h.useRef)(null),m=(0,h.useContext)(iS),p=nN(l)&&!l.accessibleWhenDisabled,{rowId:A,baseElement:g,isActiveItem:v,ariaSetSize:C,ariaPosInSet:B,isTabbable:y}=aG(e,{rowId:e=>t||(e&&(null==m?void 0:m.baseElement)&&m.baseElement===e.baseElement?m.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===c,ariaSetSize:e=>null!=o?o:e&&(null==m?void 0:m.ariaSetSize)&&m.baseElement===e.baseElement?m.ariaSetSize:void 0,ariaPosInSet(e){if(null!=s)return s;if(!e||!(null==m?void 0:m.ariaPosInSet)||m.baseElement!==e.baseElement)return;let t=e.renderedItems.filter(e=>e.rowId===A);return m.ariaPosInSet+t.findIndex(e=>e.id===c)},isTabbable(t){if(!(null==t?void 0:t.renderedItems.length))return!0;if(t.virtualFocus)return!1;if(i)return!0;if(null===t.activeId)return!1;let r=null==e?void 0:e.item(t.activeId);return null!=r&&!!r.disabled||null==r||!r.element||t.activeId===c}}),b=(0,h.useCallback)(e=>{var t;let r={...e,id:c||e.id,rowId:A,disabled:!!p,children:null==(t=e.element)?void 0:t.textContent};return a?a(r):r},[c,A,p,a]),x=l.onFocus,E=(0,h.useRef)(!1),S=n8(t=>{var r,n;if(null==x||x(t),t.defaultPrevented||nW(t)||!c||!e||(r=e,!nY(t)&&nO(r,t.target)))return;let{virtualFocus:i,baseElement:a}=e.getState();e.setActiveId(c),nT(t.currentTarget)&&function(e,t=!1){if(nM(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=nC(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!i||!nY(t)||!nT(n=t.currentTarget)&&("INPUT"!==n.tagName||nE(n))&&(null==a?void 0:a.isConnected)&&((nX()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,t.relatedTarget===a||nO(e,t.relatedTarget))?(a[nL]=!0,a.focus({preventScroll:!0})):a.focus())}),F=l.onBlurCapture,M=n8(t=>{if(null==F||F(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,t.preventDefault(),t.stopPropagation())}),T=l.onKeyDown,R=it(r),w=it(n),D=n8(t=>{if(null==T||T(t),t.defaultPrevented||!nY(t)||!e)return;let{currentTarget:r}=t,n=e.getState(),i=e.item(c),a=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,s="vertical"!==n.orientation,l=()=>!(!a&&!s&&n.baseElement&&nM(n.baseElement)),u={ArrowUp:(a||o)&&e.up,ArrowRight:(a||s)&&e.next,ArrowDown:(a||o)&&e.down,ArrowLeft:(a||s)&&e.previous,Home:()=>{if(l())return!a||t.ctrlKey?null==e?void 0:e.first():null==e?void 0:e.previous(-1)},End:()=>{if(l())return!a||t.ctrlKey?null==e?void 0:e.last():null==e?void 0:e.next(-1)},PageUp:()=>a_(r,e,null==e?void 0:e.up,!0),PageDown:()=>a_(r,e,null==e?void 0:e.down)}[t.key];if(u){if(nT(r)){let e=nR(r),n=s&&"ArrowLeft"===t.key,i=s&&"ArrowRight"===t.key,a=o&&"ArrowUp"===t.key,l=o&&"ArrowDown"===t.key;if(i||l){let{length:t}=function(e){if(nM(e))return e.value;if(e.isContentEditable){let t=nC(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(r);if(e.end!==t)return}else if((n||a)&&0!==e.start)return}let n=u();if(R(t)||void 0!==n){if(!w(t))return;t.preventDefault(),e.move(n)}}}),I=(0,h.useMemo)(()=>({id:c,baseElement:g}),[c,g]);return l={id:c,"data-active-item":v||void 0,...l=ir(l,e=>(0,d.jsx)(iE.Provider,{value:I,children:e}),[I]),ref:n4(f,l.ref),tabIndex:y?l.tabIndex:-1,onFocus:S,onBlurCapture:M,onKeyDown:D},l=aR(l),nJ({...l=aF({store:e,...l,getItem:b,shouldRegisterItem:!!c&&l.shouldRegisterItem}),"aria-setsize":C,"aria-posinset":B})});ih(id(function(e){return im("button",aP(e))}));var aH=ip(function({store:e,value:t,hideOnClick:r,setValueOnClick:n,selectValueOnClick:i=!0,resetValueOnSelect:a,focusOnHover:o=!1,moveOnKeyPress:s=!0,getItem:l,...u}){var c,f;let m=an();nU(e=e||m,!1);let{resetValueOnSelectState:p,multiSelectable:A,selected:g}=aG(e,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>(function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)})(e.selectedValue,t)}),v=(0,h.useCallback)(e=>{let r={...e,value:t};return l?l(r):r},[t,l]);n=null!=n?n:!A,r=null!=r?r:null!=t&&!A;let C=u.onClick,B=it(n),y=it(i),b=it(null!=(c=null!=a?a:p)?c:A),x=it(r),E=n8(r=>{null==C||C(r),r.defaultPrevented||function(e){let t=e.currentTarget;if(!t)return!1;let r=t.tagName.toLowerCase();return!!e.altKey&&("a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type)}(r)||!function(e){let t=e.currentTarget;if(!t)return!1;let r=nq();if(r&&!e.metaKey||!r&&!e.ctrlKey)return!1;let n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(r)&&(null!=t&&(y(r)&&(b(r)&&(null==e||e.resetValue()),null==e||e.setSelectedValue(e=>Array.isArray(e)?e.includes(t)?e.filter(e=>e!==t):[...e,t]:t)),B(r)&&(null==e||e.setValue(t))),x(r)&&(null==e||e.hide()))}),S=u.onKeyDown,F=n8(t=>{if(null==S||S(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||iL(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),nM(r)&&(null==e||e.setValue(r.value)))});A&&null!=g&&(u={"aria-selected":g,...u}),u=ir(u,e=>(0,d.jsx)(as.Provider,{value:t,children:(0,d.jsx)(al.Provider,{value:null!=g&&g,children:e})}),[t,g]),u={role:null!=(f=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,h.useContext)(ae)])?f:"option",children:t,...u,onClick:E,onKeyDown:F};let M=it(s);return u=aP({store:e,...u,getItem:v,moveOnKeyPress:t=>{if(!M(t))return!1;let r=new Event("combobox-item-move"),n=null==e?void 0:e.getState().baseElement;return null==n||n.dispatchEvent(r),!0}}),u=aS({store:e,focusOnHover:o,...u})}),ak=ih(id(function(e){return im("div",aH(e))})),aU=e.i(74080);function aj(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function aN(...e){return e.join(", ").split(", ").reduce((e,t)=>{let r=t.endsWith("ms")?1:1e3,n=Number.parseFloat(t||"0s")*r;return n>e?n:e},0)}function aJ(e,t,r){return!r&&!1!==t&&(!e||!!t)}var aK=ip(function({store:e,alwaysVisible:t,...r}){let n=iZ();nU(e=e||n,!1);let i=(0,h.useRef)(null),a=n6(r.id),[o,s]=(0,h.useState)(null),l=e.useState("open"),u=e.useState("mounted"),c=e.useState("animated"),f=e.useState("contentElement"),m=aI(e.disclosure,"contentElement");n5(()=>{i.current&&(null==e||e.setContentElement(i.current))},[e]),n5(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),n5(()=>{if(c){var e;let t;return(null==f?void 0:f.isConnected)?(e=()=>{s(l?"enter":u?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void s(null)}},[c,f,l,u]),n5(()=>{if(!e||!c||!o||!f)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,aU.flushSync)(t);if("leave"===o&&l||"enter"===o&&!l)return;if("number"==typeof c)return aj(c,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:s}=getComputedStyle(f),{transitionDuration:u="0",animationDuration:d="0",transitionDelay:h="0",animationDelay:p="0"}=m?getComputedStyle(m):{},A=aN(a,s,h,p)+aN(n,i,u,d);if(!A){"enter"===o&&e.setState("animated",!1),t();return}return aj(Math.max(A-1e3/60,0),r)},[e,c,f,m,l,o]);let p=aJ(u,(r=ir(r,t=>(0,d.jsx)(i2,{value:e,children:t}),[e])).hidden,t),A=r.style,g=(0,h.useMemo)(()=>p?{...A,display:"none"}:A,[p,A]);return nJ(r={id:a,"data-open":l||void 0,"data-enter":"enter"===o||void 0,"data-leave":"leave"===o||void 0,hidden:p,...r,ref:n4(a?e.setContentElement:null,i,r.ref),style:g})}),aQ=id(function(e){return im("div",aK(e))});id(function({unmountOnHide:e,...t}){let r=iZ();return!1===aI(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,d.jsx)(aQ,{...t})});var aV=ip(function({store:e,alwaysVisible:t,...r}){let n=an(!0),i=ar(),a=!!(e=e||i)&&e===n;nU(e,!1);let o=(0,h.useRef)(null),s=n6(r.id),l=e.useState("mounted"),u=aJ(l,r.hidden,t),c=u?{...r.style,display:"none"}:r.style,f=e.useState(e=>Array.isArray(e.selectedValue)),m=function(e,t,r){let n=function(e){let[t]=(0,h.useState)(e);return t}(r),[i,a]=(0,h.useState)(n);return(0,h.useEffect)(()=>{let r=e&&"current"in e?e.current:e;if(!r)return;let i=()=>{let e=r.getAttribute(t);a(null==e?n:e)},o=new MutationObserver(i);return o.observe(r,{attributeFilter:[t]}),i(),()=>o.disconnect()},[e,t,n]),i}(o,"role",r.role),p="listbox"===m||"tree"===m||"grid"===m,[A,g]=(0,h.useState)(!1),v=e.useState("contentElement");n5(()=>{if(!l)return;let e=o.current;if(!e||v!==e)return;let t=()=>{g(!!e.querySelector("[role='listbox']"))},r=new MutationObserver(t);return r.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>r.disconnect()},[l,v]),A||(r={role:"listbox","aria-multiselectable":p&&f||void 0,...r}),r=ir(r,t=>(0,d.jsx)(ao,{value:e,children:(0,d.jsx)(ae.Provider,{value:m,children:t})}),[e,m]);let C=!s||n&&a?null:e.setContentElement;return nJ(r={id:s,hidden:u,...r,ref:n4(C,o,r.ref),style:c})}),aq=id(function(e){return im("div",aV(e))}),aX=(0,h.createContext)(null),aW=ip(function(e){return{...e,style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px",...e.style}}});id(function(e){return im("span",aW(e))});var aY=ip(function(e){return aW(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),az=id(function(e){return im("span",aY(e))});function aZ(e){queueMicrotask(()=>{null==e||e.focus()})}var a$=ip(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:n,portal:i=!0,...a}){let o=(0,h.useRef)(null),s=n4(o,a.ref),l=(0,h.useContext)(aX),[u,c]=(0,h.useState)(null),[f,m]=(0,h.useState)(null),p=(0,h.useRef)(null),A=(0,h.useRef)(null),g=(0,h.useRef)(null),v=(0,h.useRef)(null);return n5(()=>{let e=o.current;if(!e||!i)return void c(null);let t=r?"function"==typeof r?r(e):r:nC(e).createElement("div");if(!t)return void c(null);let a=t.isConnected;if(a||(l||nC(e).body).appendChild(t),t.id||(t.id=e.id?`portal/${e.id}`:function(e="id"){return`${e?`${e}-`:""}${Math.random().toString(36).slice(2,8)}`}()),c(t),nQ(n,t),!a)return()=>{t.remove(),nQ(n,null)}},[i,r,l,n]),n5(()=>{if(!i||!e||!t)return;let r=nC(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),m(r),()=>{r.remove(),m(null)}},[i,e,t]),(0,h.useEffect)(()=>{if(!u||!e)return;let t=0,r=e=>{if(!n$(e))return;let r="focusin"===e.type;if(cancelAnimationFrame(t),r){let e=u.querySelectorAll("[data-tabindex]"),t=e=>{let t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};for(let r of(u.hasAttribute("data-tabindex")&&t(u),e))t(r);return}t=requestAnimationFrame(()=>{for(let e of iD(u,!0))!function(e){var t;let r=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",r),e.setAttribute("tabindex","-1")}(e)})};return u.addEventListener("focusin",r,!0),u.addEventListener("focusout",r,!0),()=>{cancelAnimationFrame(t),u.removeEventListener("focusin",r,!0),u.removeEventListener("focusout",r,!0)}},[u,e]),a={...a=ir(a,t=>{if(t=(0,d.jsx)(aX.Provider,{value:u||l,children:t}),!i)return t;if(!u)return(0,d.jsx)("span",{ref:s,id:a.id,style:{position:"fixed"},hidden:!0});t=(0,d.jsxs)(d.Fragment,{children:[e&&u&&(0,d.jsx)(az,{ref:A,"data-focus-trap":a.id,className:"__focus-trap-inner-before",onFocus:e=>{n$(e,u)?aZ(iI()):aZ(p.current)}}),t,e&&u&&(0,d.jsx)(az,{ref:g,"data-focus-trap":a.id,className:"__focus-trap-inner-after",onFocus:e=>{n$(e,u)?aZ(iG()):aZ(v.current)}})]}),u&&(t=(0,aU.createPortal)(t,u));let r=(0,d.jsxs)(d.Fragment,{children:[e&&u&&(0,d.jsx)(az,{ref:p,"data-focus-trap":a.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==v.current&&n$(e,u)?aZ(A.current):aZ(iG())}}),e&&(0,d.jsx)("span",{"aria-owns":null==u?void 0:u.id,style:{position:"fixed"}}),e&&u&&(0,d.jsx)(az,{ref:v,"data-focus-trap":a.id,className:"__focus-trap-outer-after",onFocus:e=>{if(n$(e,u))aZ(g.current);else{let e=iI();if(e===A.current)return void requestAnimationFrame(()=>{var e;return null==(e=iI())?void 0:e.focus()});aZ(e)}}})]});return f&&e&&(r=(0,aU.createPortal)(r,f)),(0,d.jsxs)(d.Fragment,{children:[r,t]})},[u,l,i,a.id,e,f]),ref:s}});id(function(e){return im("div",a$(e))});var a0=(0,h.createContext)(0);function a1({level:e,children:t}){let r=(0,h.useContext)(a0),n=Math.max(Math.min(e||r+1,6),1);return(0,d.jsx)(a0.Provider,{value:n,children:t})}var a2=ip(function({autoFocusOnShow:e=!0,...t}){return ir(t,t=>(0,d.jsx)(iF.Provider,{value:e,children:t}),[e])});id(function(e){return im("div",a2(e))});var a9=new WeakMap;function a3(e,t,r){a9.has(e)||a9.set(e,new Map);let n=a9.get(e),i=n.get(t);if(!i)return n.set(t,r()),()=>{var e;null==(e=n.get(t))||e(),n.delete(t)};let a=r(),o=()=>{a(),i(),n.delete(t)};return n.set(t,o),()=>{n.get(t)===o&&(a(),n.set(t,i))}}function a5(e,t,r){return a3(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function a8(e,t,r){return a3(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function a4(e,t){return e?a3(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var a6=["SCRIPT","STYLE"];function a7(e){return`__ariakit-dialog-snapshot-${e}`}function oe(e,t,r,n){for(let i of t){if(!(null==i?void 0:i.isConnected))continue;let a=t.some(e=>!!e&&e!==i&&e.contains(i)),o=nC(i),s=i;for(;i.parentElement&&i!==o.body;){if(null==n||n(i.parentElement,s),!a)for(let n of i.parentElement.children)(function(e,t,r){return!a6.includes(t.tagName)&&!!function(e,t){let r=nC(t),n=a7(e);if(!r.body[n])return!0;for(;;){if(t===r.body)return!1;if(t[n])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!r.some(e=>e&&nb(t,e))})(e,n,t)&&r(n,s);i=i.parentElement}}}function ot(e,...t){if(!e)return!1;let r=e.getAttribute("data-backdrop");return null!=r&&(""===r||"true"===r||!t.length||t.some(e=>r===e))}function or(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function on(e,t=""){return nH(a8(e,or("",!0),!0),a8(e,or(t,!0),!0))}function oi(e,t){if(e[or(t,!0)])return!0;let r=or(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function oa(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return oe(e,t,t=>{ot(t,...n)||r.unshift(function(e,t=""){return nH(a8(e,or(),!0),a8(e,or(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(on(t,e))}),()=>{for(let e of r)e()}}function oo({store:e,type:t,listener:r,capture:n,domReady:i}){let a=n8(r),o=aI(e,"open"),s=(0,h.useRef)(!1);n5(()=>{if(!o||!i)return;let{contentElement:t}=e.getState();if(!t)return;let r=()=>{s.current=!0};return t.addEventListener("focusin",r,!0),()=>t.removeEventListener("focusin",r,!0)},[e,o,i]),(0,h.useEffect)(()=>{if(o)return n1(t,t=>{let{contentElement:r,disclosureElement:n}=e.getState(),i=t.target;!r||!i||!(!("HTML"===i.tagName||nb(nC(i).body,i))||nb(r,i)||function(e,t){if(!e)return!1;if(nb(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=nC(e).getElementById(r);if(t)return nb(e,t)}return!1}(n,i)||i.hasAttribute("data-focus-trap")||function(e,t){if(!("clientY"in e))return!1;let r=t.getBoundingClientRect();return 0!==r.width&&0!==r.height&&r.top<=e.clientY&&e.clientY<=r.top+r.height&&r.left<=e.clientX&&e.clientX<=r.left+r.width}(t,r))&&(!s.current||oi(i,r.id))&&(i&&i[ik]||a(t))},n)},[o,n])}function os(e,t){return"function"==typeof e?e(t):!!e}var ol=(0,h.createContext)({});function ou(){return"inert"in HTMLElement.prototype}function oc(e,t){if(!("style"in e))return n_;if(ou())return a8(e,"inert",!0);let r=iD(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&nb(t,e)))return n_;let r=a3(e,"focus",()=>(e.focus=n_,()=>{delete e.focus}));return nH(a5(e,"tabindex","-1"),r)});return nH(...r,a5(e,"aria-hidden","true"),a4(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function od(e={}){let t=ag(e.store,aA(e.disclosure,["contentElement","disclosureElement"]));av(e,t);let r=null==t?void 0:t.getState(),n=nK(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=nK(e.animated,null==r?void 0:r.animated,!1),a=ac({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:nK(null==r?void 0:r.contentElement,null),disclosureElement:nK(null==r?void 0:r.disclosureElement,null)},t);return ad(a,()=>am(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),ad(a,()=>ah(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),ad(a,()=>am(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 of(e,t,r){return n7(t,[r.store,r.disclosure]),aL(e,r,"open","setOpen"),aL(e,r,"mounted","setMounted"),aL(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}ip(function(e){return e});var oh=id(function(e){return im("div",e)});function om({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let i=(0,h.useRef)(null),a=function(e={}){let[t,r]=aO(od,e);return of(t,r,e)}({disclosure:e}),o=aI(e,"contentElement");(0,h.useEffect)(()=>{let e=i.current;!e||o&&(e.style.zIndex=getComputedStyle(o).zIndex)},[o]),n5(()=>{let e=null==o?void 0:o.id;if(!e)return;let t=i.current;if(t)return on(t,e)},[o]);let s=aK({ref:i,store:a,role:"presentation","data-backdrop":(null==o?void 0:o.id)||"",alwaysVisible:r,hidden:null!=n?n:void 0,style:{position:"fixed",top:0,right:0,bottom:0,left:0}});if(!t)return null;if((0,h.isValidElement)(t))return(0,d.jsx)(oh,{...s,render:t});let l="boolean"!=typeof t?t:"div";return(0,d.jsx)(oh,{...s,render:(0,d.jsx)(l,{})})}function op(e={}){return od(e)}Object.assign(oh,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","summary","textarea","ul","svg"].reduce((e,t)=>(e[t]=id(function(e){return im(t,e)}),e),{}));var oA=nX();function og(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?iT(r)?r:null:r:null}var ov=ip(function({store:e,open:t,onClose:r,focusable:n=!0,modal:i=!0,portal:a=!!i,backdrop:o=!!i,hideOnEscape:s=!0,hideOnInteractOutside:l=!0,getPersistentElements:u,preventBodyScroll:c=!!i,autoFocusOnShow:f=!0,autoFocusOnHide:m=!0,initialFocus:p,finalFocus:A,unmountOnHide:g,unstable_treeSnapshotKey:v,...C}){var B;let y,b,x,E=i0(),S=(0,h.useRef)(null),F=function(e={}){let[t,r]=aO(op,e);return of(t,r,e)}({store:e||E,open:t,setOpen(e){if(e)return;let t=S.current;if(!t)return;let n=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&F.setOpen(!0)}}),{portalRef:M,domReady:T}=ii(a,C.portalRef),R=C.preserveTabOrder,w=aI(F,e=>R&&!i&&e.mounted),D=n6(C.id),I=aI(F,"open"),G=aI(F,"mounted"),L=aI(F,"contentElement"),O=aJ(G,C.hidden,C.alwaysVisible);y=function({attribute:e,contentId:t,contentElement:r,enabled:n}){let[i,a]=ie(),o=(0,h.useCallback)(()=>{if(!n||!r)return!1;let{body:i}=nC(r),a=i.getAttribute(e);return!a||a===t},[i,n,r,e,t]);return(0,h.useEffect)(()=>{if(!n||!t||!r)return;let{body:i}=nC(r);if(o())return i.setAttribute(e,t),()=>i.removeAttribute(e);let s=new MutationObserver(()=>(0,aU.flushSync)(a));return s.observe(i,{attributeFilter:[e]}),()=>s.disconnect()},[i,n,t,r,o,e]),o}({attribute:"data-dialog-prevent-body-scroll",contentElement:L,contentId:D,enabled:c&&!O}),(0,h.useEffect)(()=>{var e,t;if(!y()||!L)return;let r=nC(L),n=nB(L),{documentElement:i,body:a}=r,o=i.style.getPropertyValue("--scrollbar-width"),s=o?Number.parseInt(o,10):n.innerWidth-i.clientWidth,l=Math.round(i.getBoundingClientRect().left)+i.scrollLeft?"paddingLeft":"paddingRight",u=nq()&&!(nv&&navigator.platform.startsWith("Mac")&&!nV());return nH((e="--scrollbar-width",t=`${s}px`,i?a3(i,e,()=>{let r=i.style.getPropertyValue(e);return i.style.setProperty(e,t),()=>{r?i.style.setProperty(e,r):i.style.removeProperty(e)}}):()=>{}),u?(()=>{var e,t;let{scrollX:r,scrollY:i,visualViewport:o}=n,u=null!=(e=null==o?void 0:o.offsetLeft)?e:0,c=null!=(t=null==o?void 0:o.offsetTop)?t:0,d=a4(a,{position:"fixed",overflow:"hidden",top:`${-(i-Math.floor(c))}px`,left:`${-(r-Math.floor(u))}px`,right:"0",[l]:`${s}px`});return()=>{d(),n.scrollTo({left:r,top:i,behavior:"instant"})}})():a4(a,{overflow:"hidden",[l]:`${s}px`}))},[y,L]),B=aI(F,"open"),b=(0,h.useRef)(),(0,h.useEffect)(()=>{if(!B){b.current=null;return}return n1("mousedown",e=>{b.current=e.target},!0)},[B]),oo({...x={store:F,domReady:T,capture:!0},type:"click",listener:e=>{let{contentElement:t}=F.getState(),r=b.current;r&&nF(r)&&oi(r,null==t?void 0:t.id)&&os(l,e)&&F.hide()}}),oo({...x,type:"focusin",listener:e=>{let{contentElement:t}=F.getState();!t||e.target===nC(t)||os(l,e)&&F.hide()}}),oo({...x,type:"contextmenu",listener:e=>{os(l,e)&&F.hide()}});let{wrapElement:_,nestedDialogs:P}=function(e){let t=(0,h.useContext)(ol),[r,n]=(0,h.useState)([]),i=(0,h.useCallback)(e=>{var r;return n(t=>[...t,e]),nH(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);n5(()=>am(e,["open","contentElement"],r=>{var n;if(r.open&&r.contentElement)return null==(n=t.add)?void 0:n.call(t,e)}),[e,t]);let a=(0,h.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,h.useCallback)(e=>(0,d.jsx)(ol.Provider,{value:a,children:e}),[a]),nestedDialogs:r}}(F);C=ir(C,_,[_]),n5(()=>{if(!I)return;let e=S.current,t=ny(e,!0);!t||"BODY"===t.tagName||e&&nb(e,t)||F.setDisclosureElement(t)},[F,I]),oA&&(0,h.useEffect)(()=>{if(!G)return;let{disclosureElement:e}=F.getState();if(!e||!nE(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),n0(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||i_(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[F,G]),(0,h.useEffect)(()=>{if(!G||!T)return;let e=S.current;if(!e)return;let t=nB(e),r=t.visualViewport||t,n=()=>{var r,n;let i=null!=(n=null==(r=t.visualViewport)?void 0:r.height)?n:t.innerHeight;e.style.setProperty("--dialog-viewport-height",`${i}px`)};return n(),r.addEventListener("resize",n),()=>{r.removeEventListener("resize",n)}},[G,T]),(0,h.useEffect)(()=>{if(!i||!G||!T)return;let e=S.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=F.hide,(r=nC(e).createElement("button")).type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[F,i,G,T]),n5(()=>{if(!ou()||I||!G||!T)return;let e=S.current;if(e)return oc(e)},[I,G,T]);let H=I&&T;n5(()=>{if(D&&H)return function(e,t){let{body:r}=nC(t[0]),n=[];return oe(e,t,t=>{n.push(a8(t,a7(e),!0))}),nH(a8(r,a7(e),!0),()=>{for(let e of n)e()})}(D,[S.current])},[D,H,v]);let k=n8(u);n5(()=>{if(!D||!H)return;let{disclosureElement:e}=F.getState(),t=[S.current,...k()||[],...P.map(e=>e.getState().contentElement)];if(i){let e,r;return nH(oa(D,t),(e=[],r=t.map(e=>null==e?void 0:e.id),oe(D,t,n=>{ot(n,...r)||!function(e,...t){if(!e)return!1;let r=e.getAttribute("data-focus-trap");return null!=r&&(!t.length||""!==r&&t.some(e=>r===e))}(n,...r)&&e.unshift(oc(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&nb(e,r))||e.unshift(a5(r,"role","none"))}),()=>{for(let t of e)t()}))}return oa(D,[e,...t])},[D,F,H,k,P,i,v]);let U=!!f,j=it(f),[N,J]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!I||!U||!T||!(null==L?void 0:L.isConnected))return;let e=og(p,!0)||L.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=iD(e,t,r);return n||null}(L,!0,a&&w)||L,t=iT(e);j(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!oA||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[I,U,T,L,p,a,w,j]);let K=!!m,Q=it(m),[V,q]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(I)return q(!0),()=>q(!1)},[I]);let X=(0,h.useCallback)((e,t=!0)=>{let r,{disclosureElement:n}=F.getState();if(!(!(r=ny())||e&&nb(e,r))&&iT(r))return;let i=og(A)||n;if(null==i?void 0:i.id){let e=nC(i),t=`[aria-activedescendant="${i.id}"]`,r=e.querySelector(t);r&&(i=r)}if(i&&!iT(i)){let e=i.closest("[data-dialog]");if(null==e?void 0:e.id){let t=nC(e),r=`[aria-controls~="${e.id}"]`,n=t.querySelector(r);n&&(i=n)}}let a=i&&iT(i);!a&&t?requestAnimationFrame(()=>X(e,!1)):!Q(a?i:null)||a&&(null==i||i.focus({preventScroll:!0}))},[F,A,Q]),W=(0,h.useRef)(!1);n5(()=>{if(I||!V||!K)return;let e=S.current;W.current=!0,X(e)},[I,V,T,K,X]),(0,h.useEffect)(()=>{if(!V||!K)return;let e=S.current;return()=>{if(W.current){W.current=!1;return}X(e)}},[V,K,X]);let Y=it(s);(0,h.useEffect)(()=>{if(T&&G)return n1("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=S.current;if(!t||oi(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=F.getState();!("BODY"===r.tagName||nb(t,r)||!n||nb(n,r))||Y(e)&&F.hide()},!0)},[F,T,G,Y]);let z=(C=ir(C,e=>(0,d.jsx)(a1,{level:i?1:void 0,children:e}),[i])).hidden,Z=C.alwaysVisible;C=ir(C,e=>o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(om,{store:F,backdrop:o,hidden:z,alwaysVisible:Z}),e]}):e,[F,o,z,Z]);let[$,ee]=(0,h.useState)(),[et,er]=(0,h.useState)();return C=a2({...C={id:D,"data-dialog":"",role:"dialog",tabIndex:n?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...C=ir(C,e=>(0,d.jsx)(i2,{value:F,children:(0,d.jsx)(i9.Provider,{value:ee,children:(0,d.jsx)(i3.Provider,{value:er,children:e})})}),[F]),ref:n4(S,C.ref)},autoFocusOnShow:N}),C=a$({portal:a,...C=iV({...C=aK({store:F,...C}),focusable:n}),portalRef:M,preserveTabOrder:w})});function oC(e,t=i0){return id(function(r){let n=t();return aI(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,d.jsx)(e,{...r}):null})}oC(id(function(e){return im("div",ov(e))}),i0);let oB=Math.min,oy=Math.max,ob=Math.round,ox=Math.floor,oE=e=>({x:e,y:e}),oS={left:"right",right:"left",bottom:"top",top:"bottom"},oF={start:"end",end:"start"};function oM(e,t){return"function"==typeof e?e(t):e}function oT(e){return e.split("-")[0]}function oR(e){return e.split("-")[1]}function ow(e){return"x"===e?"y":"x"}function oD(e){return"y"===e?"height":"width"}let oI=new Set(["top","bottom"]);function oG(e){return oI.has(oT(e))?"y":"x"}function oL(e){return e.replace(/start|end/g,e=>oF[e])}let oO=["left","right"],o_=["right","left"],oP=["top","bottom"],oH=["bottom","top"];function ok(e){return e.replace(/left|right|bottom|top/g,e=>oS[e])}function oU(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oj(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function oN(e,t,r){let n,{reference:i,floating:a}=e,o=oG(t),s=ow(oG(t)),l=oD(s),u=oT(t),c="y"===o,d=i.x+i.width/2-a.width/2,f=i.y+i.height/2-a.height/2,h=i[l]/2-a[l]/2;switch(u){case"top":n={x:d,y:i.y-a.height};break;case"bottom":n={x:d,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:f};break;case"left":n={x:i.x-a.width,y:f};break;default:n={x:i.x,y:i.y}}switch(oR(t)){case"start":n[s]-=h*(r&&c?-1:1);break;case"end":n[s]+=h*(r&&c?-1:1)}return n}let oJ=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:a=[],platform:o}=r,s=a.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=oN(u,n,l),f=n,h={},m=0;for(let r=0;r<s.length;r++){let{name:a,fn:p}=s[r],{x:A,y:g,data:v,reset:C}=await p({x:c,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:t}});c=null!=A?A:c,d=null!=g?g:d,h={...h,[a]:{...h[a],...v}},C&&m<=50&&(m++,"object"==typeof C&&(C.placement&&(f=C.placement),C.rects&&(u=!0===C.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):C.rects),{x:c,y:d}=oN(u,f,l)),r=-1)}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function oK(e,t){var r;void 0===t&&(t={});let{x:n,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=oM(t,e),m=oU(h),p=s[f?"floating"===d?"reference":"floating":d],A=oj(await a.getClippingRect({element:null==(r=await (null==a.isElement?void 0:a.isElement(p)))||r?p:p.contextElement||await (null==a.getDocumentElement?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),g="floating"===d?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await (null==a.getOffsetParent?void 0:a.getOffsetParent(s.floating)),C=await (null==a.isElement?void 0:a.isElement(v))&&await (null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},B=oj(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:v,strategy:l}):g);return{top:(A.top-B.top+m.top)/C.y,bottom:(B.bottom-A.bottom+m.bottom)/C.y,left:(A.left-B.left+m.left)/C.x,right:(B.right-A.right+m.right)/C.x}}let oQ=new Set(["left","top"]);async function oV(e,t){let{placement:r,platform:n,elements:i}=e,a=await (null==n.isRTL?void 0:n.isRTL(i.floating)),o=oT(r),s=oR(r),l="y"===oG(r),u=oQ.has(o)?-1:1,c=a&&l?-1:1,d=oM(t,e),{mainAxis:f,crossAxis:h,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof m&&(h="end"===s?-1*m:m),l?{x:h*c,y:f*u}:{x:f*u,y:h*c}}function oq(){return"undefined"!=typeof window}function oX(e){return oz(e)?(e.nodeName||"").toLowerCase():"#document"}function oW(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function oY(e){var t;return null==(t=(oz(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function oz(e){return!!oq()&&(e instanceof Node||e instanceof oW(e).Node)}function oZ(e){return!!oq()&&(e instanceof Element||e instanceof oW(e).Element)}function o$(e){return!!oq()&&(e instanceof HTMLElement||e instanceof oW(e).HTMLElement)}function o0(e){return!!oq()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof oW(e).ShadowRoot)}let o1=new Set(["inline","contents"]);function o2(e){let{overflow:t,overflowX:r,overflowY:n,display:i}=sn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!o1.has(i)}let o9=new Set(["table","td","th"]),o3=[":popover-open",":modal"];function o5(e){return o3.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let o8=["transform","translate","scale","rotate","perspective"],o4=["transform","translate","scale","rotate","perspective","filter"],o6=["paint","layout","strict","content"];function o7(e){let t=se(),r=oZ(e)?sn(e):e;return o8.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||o4.some(e=>(r.willChange||"").includes(e))||o6.some(e=>(r.contain||"").includes(e))}function se(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let st=new Set(["html","body","#document"]);function sr(e){return st.has(oX(e))}function sn(e){return oW(e).getComputedStyle(e)}function si(e){return oZ(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sa(e){if("html"===oX(e))return e;let t=e.assignedSlot||e.parentNode||o0(e)&&e.host||oY(e);return o0(t)?t.host:t}function so(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=sa(t);return sr(r)?t.ownerDocument?t.ownerDocument.body:t.body:o$(r)&&o2(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=oW(i);if(a){let e=ss(o);return t.concat(o,o.visualViewport||[],o2(i)?i:[],e&&r?so(e):[])}return t.concat(i,so(i,[],r))}function ss(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sl(e){let t=sn(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=o$(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,s=ob(r)!==a||ob(n)!==o;return s&&(r=a,n=o),{width:r,height:n,$:s}}function su(e){return oZ(e)?e:e.contextElement}function sc(e){let t=su(e);if(!o$(t))return oE(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=sl(t),o=(a?ob(r.width):r.width)/n,s=(a?ob(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let sd=oE(0);function sf(e){let t=oW(e);return se()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:sd}function sh(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=su(e),s=oE(1);t&&(n?oZ(n)&&(s=sc(n)):s=sc(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===oW(o))&&i)?sf(o):oE(0),u=(a.left+l.x)/s.x,c=(a.top+l.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){let e=oW(o),t=n&&oZ(n)?oW(n):n,r=e,i=ss(r);for(;i&&n&&t!==r;){let e=sc(i),t=i.getBoundingClientRect(),n=sn(i),a=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,d*=e.x,f*=e.y,u+=a,c+=o,i=ss(r=oW(i))}}return oj({width:d,height:f,x:u,y:c})}function sm(e,t){let r=si(e).scrollLeft;return t?t.left+r:sh(oY(e)).left+r}function sp(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-sm(e,r),y:r.top+t.scrollTop}}let sA=new Set(["absolute","fixed"]);function sg(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=oW(e),n=oY(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=se();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}let u=sm(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else u<=25&&(a+=u);return{width:a,height:o,x:s,y:l}}(e,r);else if("document"===t){let t,r,a,o,s,l,u;n=oY(e),t=oY(n),r=si(n),a=n.ownerDocument.body,o=oy(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=oy(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),l=-r.scrollLeft+sm(n),u=-r.scrollTop,"rtl"===sn(a).direction&&(l+=oy(t.clientWidth,a.clientWidth)-o),i={width:o,height:s,x:l,y:u}}else if(oZ(t)){let e,n,a,o,s,l;n=(e=sh(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=o$(t)?sc(t):oE(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,i={width:s,height:l,x:a*o.x,y:n*o.y}}else{let r=sf(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oj(i)}function sv(e){return"static"===sn(e).position}function sC(e,t){if(!o$(e)||"fixed"===sn(e).position)return null;if(t)return t(e);let r=e.offsetParent;return oY(e)===r&&(r=r.ownerDocument.body),r}function sB(e,t){var r;let n=oW(e);if(o5(e))return n;if(!o$(e)){let t=sa(e);for(;t&&!sr(t);){if(oZ(t)&&!sv(t))return t;t=sa(t)}return n}let i=sC(e,t);for(;i&&(r=i,o9.has(oX(r)))&&sv(i);)i=sC(i,t);return i&&sr(i)&&sv(i)&&!o7(i)?n:i||function(e){let t=sa(e);for(;o$(t)&&!sr(t);){if(o7(t))return t;if(o5(t))break;t=sa(t)}return null}(e)||n}let sy=async function(e){let t=this.getOffsetParent||sB,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=o$(t),i=oY(t),a="fixed"===r,o=sh(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=oE(0);if(n||!n&&!a)if(("body"!==oX(t)||o2(i))&&(s=si(t)),n){let e=sh(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=sm(i));a&&!n&&i&&(l.x=sm(i));let u=!i||n||a?oE(0):sp(i,s);return{x:o.left+s.scrollLeft-l.x-u.x,y:o.top+s.scrollTop-l.y-u.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},sb={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=oY(n),s=!!t&&o5(t.floating);if(n===o||s&&a)return r;let l={scrollLeft:0,scrollTop:0},u=oE(1),c=oE(0),d=o$(n);if((d||!d&&!a)&&(("body"!==oX(n)||o2(o))&&(l=si(n)),o$(n))){let e=sh(n);u=sc(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?oE(0):sp(o,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:r.y*u.y-l.scrollTop*u.y+c.y+f.y}},getDocumentElement:oY,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?o5(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=so(e,[],!1).filter(e=>oZ(e)&&"body"!==oX(e)),i=null,a="fixed"===sn(e).position,o=a?sa(e):e;for(;oZ(o)&&!sr(o);){let t=sn(o),r=o7(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&sA.has(i.position)||o2(o)&&!r&&function e(t,r){let n=sa(t);return!(n===r||!oZ(n)||sr(n))&&("fixed"===sn(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=sa(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],s=a.reduce((e,r)=>{let n=sg(t,r,i);return e.top=oy(n.top,e.top),e.right=oB(n.right,e.right),e.bottom=oB(n.bottom,e.bottom),e.left=oy(n.left,e.left),e},sg(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:sB,getElementRects:sy,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=sl(e);return{width:t,height:r}},getScale:sc,isElement:oZ,isRTL:function(e){return"rtl"===sn(e).direction}};function sx(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sE(e=0,t=0,r=0,n=0){if("function"==typeof DOMRect)return new DOMRect(e,t,r,n);let i={x:e,y:t,width:r,height:n,top:t,right:e+r,bottom:t+n,left:e};return{...i,toJSON:()=>i}}function sS(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function sF(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var sM=ip(function({store:e,modal:t=!1,portal:r=!!t,preserveTabOrder:n=!0,autoFocusOnShow:i=!0,wrapperProps:a,fixed:o=!1,flip:s=!0,shift:l=0,slide:u=!0,overlap:c=!1,sameWidth:f=!1,fitViewport:m=!1,gutter:p,arrowPadding:A=4,overflowPadding:g=8,getAnchorRect:v,updatePosition:C,...B}){let y=i8();nU(e=e||y,!1);let b=e.useState("arrowElement"),x=e.useState("anchorElement"),E=e.useState("disclosureElement"),S=e.useState("popoverElement"),F=e.useState("contentElement"),M=e.useState("placement"),T=e.useState("mounted"),R=e.useState("rendered"),w=(0,h.useRef)(null),[D,I]=(0,h.useState)(!1),{portalRef:G,domReady:L}=ii(r,B.portalRef),O=n8(v),_=n8(C),P=!!C;n5(()=>{if(!(null==S?void 0:S.isConnected))return;S.style.setProperty("--popover-overflow-padding",`${g}px`);let t={contextElement:x||void 0,getBoundingClientRect:()=>{let e=null==O?void 0:O(x);return e||!x?function(e){if(!e)return sE();let{x:t,y:r,width:n,height:i}=e;return sE(t,r,n,i)}(e):x.getBoundingClientRect()}},r=async()=>{var r,n,i,a,d;let h,v,C;if(!T)return;b||(w.current=w.current||document.createElement("div"));let B=b||w.current,y=[(r={gutter:p,shift:l},void 0===(n=({placement:e})=>{var t;let n=((null==B?void 0:B.clientHeight)||0)/2,i="number"==typeof r.gutter?r.gutter+n:null!=(t=r.gutter)?t:n;return{crossAxis:e.split("-")[1]?void 0:r.shift,mainAxis:i,alignmentAxis:r.shift}})&&(n=0),{name:"offset",options:n,async fn(e){var t,r;let{x:i,y:a,placement:o,middlewareData:s}=e,l=await oV(e,n);return o===(null==(t=s.offset)?void 0:t.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}),function(e){var t;if(!1===e.flip)return;let r="string"==typeof e.flip?e.flip.split(" "):void 0;return nU(!r||r.every(sS),!1),{name:"flip",options:t={padding:e.overflowPadding,fallbackPlacements:r},async fn(e){var r,n,i,a,o,s,l,u;let c,d,f,{placement:h,middlewareData:m,rects:p,initialPlacement:A,platform:g,elements:v}=e,{mainAxis:C=!0,crossAxis:B=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:E=!0,...S}=oM(t,e);if(null!=(r=m.arrow)&&r.alignmentOffset)return{};let F=oT(h),M=oG(A),T=oT(A)===A,R=await (null==g.isRTL?void 0:g.isRTL(v.floating)),w=y||(T||!E?[ok(A)]:(c=ok(A),[oL(A),c,oL(c)])),D="none"!==x;!y&&D&&w.push(...(d=oR(A),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?o_:oO;return t?oO:o_;case"left":case"right":return t?oP:oH;default:return[]}}(oT(A),"start"===x,R),d&&(f=f.map(e=>e+"-"+d),E&&(f=f.concat(f.map(oL)))),f));let I=[A,...w],G=await oK(e,S),L=[],O=(null==(n=m.flip)?void 0:n.overflows)||[];if(C&&L.push(G[F]),B){let e,t,r,n,i=(s=h,l=p,void 0===(u=R)&&(u=!1),e=oR(s),r=oD(t=ow(oG(s))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(n=ok(n)),[n,ok(n)]);L.push(G[i[0]],G[i[1]])}if(O=[...O,{placement:h,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=m.flip)?void 0:i.index)||0)+1,t=I[e];if(t&&("alignment"!==B||M===oG(t)||O.every(e=>oG(e.placement)!==M||e.overflows[0]>0)))return{data:{index:e,overflows:O},reset:{placement:t}};let r=null==(a=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(b){case"bestFit":{let e=null==(o=O.filter(e=>{if(D){let t=oG(e.placement);return t===M||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=A}if(h!==r)return{reset:{placement:r}}}return{}}}}({flip:s,overflowPadding:g}),function(e){if(e.slide||e.overlap){var t,r;return{name:"shift",options:r={mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:(void 0===t&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:i,rects:a,middlewareData:o}=e,{offset:s=0,mainAxis:l=!0,crossAxis:u=!0}=oM(t,e),c={x:r,y:n},d=oG(i),f=ow(d),h=c[f],m=c[d],p=oM(s,e),A="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+A.mainAxis,r=a.reference[f]+a.reference[e]-A.mainAxis;h<t?h=t:h>r&&(h=r)}if(u){var g,v;let e="y"===f?"width":"height",t=oQ.has(oT(i)),r=a.reference[d]-a.floating[e]+(t&&(null==(g=o.offset)?void 0:g[d])||0)+(t?0:A.crossAxis),n=a.reference[d]+a.reference[e]+(t?0:(null==(v=o.offset)?void 0:v[d])||0)-(t?A.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:h,[d]:m}}})},async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=oM(r,e),u={x:t,y:n},c=await oK(e,l),d=oG(oT(i)),f=ow(d),h=u[f],m=u[d];if(a){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=h+c[e],n=h-c[t];h=oy(r,oB(h,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=m+c[e],n=m-c[t];m=oy(r,oB(m,n))}let p=s.fn({...e,[f]:h,[d]:m});return{...p,data:{x:p.x-t,y:p.y-n,enabled:{[f]:a,[d]:o}}}}}}}({slide:u,shift:l,overlap:c,overflowPadding:g}),function(e,t){if(e){let r;return{name:"arrow",options:r={element:e,padding:t.arrowPadding},async fn(e){let{x:t,y:n,placement:i,rects:a,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=oM(r,e)||{};if(null==u)return{};let d=oU(c),f={x:t,y:n},h=ow(oG(i)),m=oD(h),p=await o.getDimensions(u),A="y"===h,g=A?"clientHeight":"clientWidth",v=a.reference[m]+a.reference[h]-f[h]-a.floating[m],C=f[h]-a.reference[h],B=await (null==o.getOffsetParent?void 0:o.getOffsetParent(u)),y=B?B[g]:0;y&&await (null==o.isElement?void 0:o.isElement(B))||(y=s.floating[g]||a.floating[m]);let b=y/2-p[m]/2-1,x=oB(d[A?"top":"left"],b),E=oB(d[A?"bottom":"right"],b),S=y-p[m]-E,F=y/2-p[m]/2+(v/2-C/2),M=oy(x,oB(F,S)),T=!l.arrow&&null!=oR(i)&&F!==M&&a.reference[m]/2-(F<x?x:E)-p[m]/2<0,R=T?F<x?F-x:F-S:0;return{[h]:f[h]+R,data:{[h]:M,centerOffset:F-M-R,...T&&{alignmentOffset:R}},reset:T}}}}}(B,{arrowPadding:A}),{name:"size",options:a={padding:(i={sameWidth:f,fitViewport:m,overflowPadding:g}).overflowPadding,apply({elements:e,availableWidth:t,availableHeight:r,rects:n}){let a=e.floating,o=Math.round(n.reference.width);t=Math.floor(t),r=Math.floor(r),a.style.setProperty("--popover-anchor-width",`${o}px`),a.style.setProperty("--popover-available-width",`${t}px`),a.style.setProperty("--popover-available-height",`${r}px`),i.sameWidth&&(a.style.width=`${o}px`),i.fitViewport&&(a.style.maxWidth=`${t}px`,a.style.maxHeight=`${r}px`)}},async fn(e){var t,r;let n,i,{placement:o,rects:s,platform:l,elements:u}=e,{apply:c=()=>{},...d}=oM(a,e),f=await oK(e,d),h=oT(o),m=oR(o),p="y"===oG(o),{width:A,height:g}=s.floating;"top"===h||"bottom"===h?(n=h,i=m===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(i=h,n="end"===m?"top":"bottom");let v=g-f.top-f.bottom,C=A-f.left-f.right,B=oB(g-f[n],v),y=oB(A-f[i],C),b=!e.middlewareData.shift,x=B,E=y;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(E=C),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(x=v),b&&!m){let e=oy(f.left,0),t=oy(f.right,0),r=oy(f.top,0),n=oy(f.bottom,0);p?E=A-2*(0!==e||0!==t?e+t:oy(f.left,f.right)):x=g-2*(0!==r||0!==n?r+n:oy(f.top,f.bottom))}await c({...e,availableWidth:E,availableHeight:x});let S=await l.getDimensions(u.floating);return A!==S.width||g!==S.height?{reset:{rects:!0}}:{}}}],x=await (d={placement:M,strategy:o?"fixed":"absolute",middleware:y},h=new Map,C={...(v={platform:sb,...d}).platform,_c:h},oJ(t,S,{...v,platform:C}));null==e||e.setState("currentPlacement",x.placement),I(!0);let E=sF(x.x),F=sF(x.y);if(Object.assign(S.style,{top:"0",left:"0",transform:`translate3d(${E}px,${F}px,0)`}),B&&x.middlewareData.arrow){let{x:e,y:t}=x.middlewareData.arrow,r=x.placement.split("-")[0],n=B.clientWidth/2,i=B.clientHeight/2,a=null!=e?e+n:-n,o=null!=t?t+i:-i;S.style.setProperty("--popover-transform-origin",{top:`${a}px calc(100% + ${i}px)`,bottom:`${a}px ${-i}px`,left:`calc(100% + ${n}px) ${o}px`,right:`${-n}px ${o}px`}[r]),Object.assign(B.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[r]:"100%"})}},n=function(e,t,r,n){let i;void 0===n&&(n={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=su(e),d=a||o?[...c?so(c):[],...so(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});let f=c&&l?function(e,t){let r,n=null,i=oY(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),a();let u=e.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(s||t(),!f||!h)return;let m={rootMargin:-ox(d)+"px "+-ox(i.clientWidth-(c+f))+"px "+-ox(i.clientHeight-(d+h))+"px "+-ox(c)+"px",threshold:oy(0,oB(1,l))||1},p=!0;function A(t){let n=t[0].intersectionRatio;if(n!==l){if(!p)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||sx(u,e.getBoundingClientRect())||o(),p=!1}try{n=new IntersectionObserver(A,{...m,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(A,m)}n.observe(e)}(!0),a}(c,r):null,h=-1,m=null;s&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!u&&m.observe(c),m.observe(t));let p=u?sh(e):null;return u&&function t(){let n=sh(e);p&&!sx(p,n)&&r(),p=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==f||f(),null==(e=m)||e.disconnect(),m=null,u&&cancelAnimationFrame(i)}}(t,S,async()=>{P?(await _({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[e,R,S,b,x,S,M,T,L,o,s,l,u,c,f,m,p,A,g,O,P,_]),n5(()=>{if(!T||!L||!(null==S?void 0:S.isConnected)||!(null==F?void 0:F.isConnected))return;let e=()=>{S.style.zIndex=getComputedStyle(F).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,S,F]);let H=o?"fixed":"absolute";return B=ir(B,t=>(0,d.jsx)("div",{...a,style:{position:H,top:0,left:0,width:"max-content",...null==a?void 0:a.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,H,a]),B={"data-placing":!D||void 0,...B=ir(B,t=>(0,d.jsx)(i6,{value:e,children:t}),[e]),style:{position:"relative",...B.style}},B=ov({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:E||x,autoFocusOnShow:D&&i,...B,portalRef:G})});oC(id(function(e){return im("div",sM(e))}),i8);var sT=ip(function({store:e,modal:t,tabIndex:r,alwaysVisible:n,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...o}){let s=ai();nU(e=e||s,!1);let l=e.useState("baseElement"),u=(0,h.useRef)(!1),c=aI(e.tag,e=>null==e?void 0:e.renderedItems.length);return o=aV({store:e,alwaysVisible:n,...o}),o=sM({store:e,modal:t,alwaysVisible:n,backdrop:!1,autoFocusOnShow:!1,finalFocus:l,preserveTabOrderAnchor:null,unstable_treeSnapshotKey:c,...o,getPersistentElements(){var r;let n=(null==(r=o.getPersistentElements)?void 0:r.call(o))||[];if(!t||!e)return n;let{contentElement:i,baseElement:a}=e.getState();if(!a)return n;let s=nC(a),l=[];if((null==i?void 0:i.id)&&l.push(`[aria-controls~="${i.id}"]`),(null==a?void 0:a.id)&&l.push(`[aria-controls~="${a.id}"]`),!l.length)return[...n,a];let u=l.join(",");return[...n,...s.querySelectorAll(u)]},autoFocusOnHide:e=>!nj(i,e)&&(!u.current||(u.current=!1,!1)),hideOnInteractOutside(t){var r,n;let i=null==e?void 0:e.getState(),o=null==(r=null==i?void 0:i.contentElement)?void 0:r.id,s=null==(n=null==i?void 0:i.baseElement)?void 0:n.id;if(function(e,...t){if(!e)return!1;if("id"in e){let r=t.filter(Boolean).map(e=>`[aria-controls~="${e}"]`).join(", ");return!!r&&e.matches(r)}return!1}(t.target,o,s))return!1;let l="function"==typeof a?a(t):a;return l&&(u.current="click"===t.type),l}})}),sR=oC(id(function(e){return im("div",sT(e))}),ai);(0,h.createContext)(null),(0,h.createContext)(null);var sw=iA([ib],[ix]),sD=sw.useContext;sw.useScopedContext,sw.useProviderContext,sw.ContextProvider,sw.ScopedContextProvider;var sI={id:null};function sG(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function sL(e,t){return e.filter(e=>e.rowId===t)}function sO(e){let t=[];for(let r of e){let e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===r.rowId});e?e.push(r):t.push([r])}return t}function s_(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var sP=nX()&&nV();function sH({tag:e,...t}={}){let r=ag(t.store,function(e,...t){if(e)return au(e,"pick")(...t)}(e,["value","rtl"]));av(t,r);let n=null==e?void 0:e.getState(),i=null==r?void 0:r.getState(),a=nK(t.activeId,null==i?void 0:i.activeId,t.defaultActiveId,null),o=function(e={}){var t;let r=null==(t=e.store)?void 0:t.getState(),n=function(e={}){var t,r;av(e,e.store);let n=null==(t=e.store)?void 0:t.getState(),i=nK(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:nK(null==n?void 0:n.renderedItems,[])},s=null==(r=e.store)?void 0:r.__unstablePrivateStore,l=ac({items:i,renderedItems:o.renderedItems},s),u=ac(o,e.store),c=e=>{var t;let r,n,i=(t=e=>e.element,r=e.map((e,t)=>[t,e]),n=!1,(r.sort(([e,r],[i,a])=>{var o;let s=t(r),l=t(a);return s!==l&&s&&l?(o=s,l.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)?(e>i&&(n=!0),-1):(e<i&&(n=!0),1):0}),n)?r.map(([e,t])=>t):e);l.setState("renderedItems",i),u.setState("renderedItems",i)};ad(u,()=>af(l)),ad(l,()=>ap(l,["items"],e=>{u.setState("items",e.items)})),ad(l,()=>ap(l,["renderedItems"],e=>{let t=!0,r=requestAnimationFrame(()=>{let{renderedItems:t}=u.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(r);let n=new IntersectionObserver(()=>{if(t){t=!1;return}cancelAnimationFrame(r),r=requestAnimationFrame(()=>c(e.renderedItems))},{root:function(e){var t;let r=e.find(e=>!!e.element),n=[...e].reverse().find(e=>!!e.element),i=null==(t=null==r?void 0:r.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){let e=i;if(n&&e.contains(n.element))return i;i=i.parentElement}return nC(i).body}(e.renderedItems)});for(let t of e.renderedItems)t.element&&n.observe(t.element);return()=>{cancelAnimationFrame(r),n.disconnect()}}));let d=(e,t,r=!1)=>{let n;return t(t=>{let r=t.findIndex(({id:t})=>t===e.id),i=t.slice();if(-1!==r){let o={...n=t[r],...e};i[r]=o,a.set(e.id,o)}else i.push(e),a.set(e.id,e);return i}),()=>{t(t=>{if(!n)return r&&a.delete(e.id),t.filter(({id:t})=>t!==e.id);let i=t.findIndex(({id:t})=>t===e.id);if(-1===i)return t;let o=t.slice();return o[i]=n,a.set(e.id,n),o})}},f=e=>d(e,e=>l.setState("items",e),!0);return{...u,registerItem:f,renderItem:e=>nH(f(e),d(e,e=>l.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=a.get(e);if(!t){let{items:r}=l.getState();(t=r.find(t=>t.id===e))&&a.set(e,t)}return t||null},__unstablePrivateStore:l}}(e),i=nK(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=ac({...n.getState(),id:nK(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:nK(null==r?void 0:r.baseElement,null),includesBaseElement:nK(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:nK(null==r?void 0:r.moves,0),orientation:nK(e.orientation,null==r?void 0:r.orientation,"both"),rtl:nK(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:nK(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:nK(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:nK(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:nK(e.focusShift,null==r?void 0:r.focusShift,!1)},n,e.store);ad(a,()=>am(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=sG(e.renderedItems))?void 0:r.id})}));let o=(e="next",t={})=>{var r,n;let i=a.getState(),{skip:o=0,activeId:s=i.activeId,focusShift:l=i.focusShift,focusLoop:u=i.focusLoop,focusWrap:c=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:h=i.rtl}=t,m="up"===e||"down"===e,p="next"===e||"down"===e,A=m?iq(function(e,t,r){let n=s_(e);for(let i of e)for(let e=0;e<n;e+=1){let n=i[e];if(!n||r&&n.disabled){let n=0===e&&r?sG(i):i[e-1];i[e]=n&&t!==n.id&&r?n:{id:"__EMPTY_ITEM__",disabled:!0,rowId:null==n?void 0:n.rowId}}}return e}(sO(f),s,l&&!o)):f;if(A=(p?h&&!m:!h||m)?iX(A):A,A=m?function(e){let t=sO(e),r=s_(t),n=[];for(let e=0;e<r;e+=1)for(let r of t){let t=r[e];t&&n.push({...t,rowId:t.rowId?`${e}`:void 0})}return n}(A):A,null==s)return null==(r=sG(A))?void 0:r.id;let g=A.find(e=>e.id===s);if(!g)return null==(n=sG(A))?void 0:n.id;let v=A.some(e=>e.rowId),C=A.indexOf(g),B=A.slice(C+1),y=sL(B,g.rowId);if(o){let e=y.filter(e=>s?!e.disabled&&e.id!==s:!e.disabled),t=e.slice(o)[0]||e[e.length-1];return null==t?void 0:t.id}let b=u&&(m?"horizontal"!==u:"vertical"!==u),x=v&&c&&(m?"horizontal"!==c:"vertical"!==c),E=p?(!v||m)&&b&&d:!!m&&d;if(b){let e=sG(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[sI]:[],...e.slice(0,n)]}(x&&!E?A:sL(A,g.rowId),s,E),s);return null==e?void 0:e.id}if(x){let e=sG(E?y:B,s);return E?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let S=sG(y,s);return!S&&E?null:null==S?void 0:S.id};return{...n,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=sG(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=sG(iX(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),o("up",e))}}({...t,activeId:a,includesBaseElement:nK(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:nK(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:nK(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:nK(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:nK(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),s=function({popover:e,...t}={}){let r=ag(t.store,aA(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));av(t,r);let n=null==r?void 0:r.getState(),i=op({...t,store:r}),a=nK(t.placement,null==n?void 0:n.placement,"bottom"),o=ac({...i.getState(),placement:a,currentPlacement:a,anchorElement:nK(null==n?void 0:n.anchorElement,null),popoverElement:nK(null==n?void 0:n.popoverElement,null),arrowElement:nK(null==n?void 0:n.arrowElement,null),rendered:Symbol("rendered")},i,r);return{...i,...o,setAnchorElement:e=>o.setState("anchorElement",e),setPopoverElement:e=>o.setState("popoverElement",e),setArrowElement:e=>o.setState("arrowElement",e),render:()=>o.setState("rendered",Symbol("rendered"))}}({...t,placement:nK(t.placement,null==i?void 0:i.placement,"bottom-start")}),l=nK(t.value,null==i?void 0:i.value,t.defaultValue,""),u=nK(t.selectedValue,null==i?void 0:i.selectedValue,null==n?void 0:n.values,t.defaultSelectedValue,""),c=Array.isArray(u),d={...o.getState(),...s.getState(),value:l,selectedValue:u,resetValueOnSelect:nK(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:nK(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=ac(d,o,s,r);return sP&&ad(f,()=>am(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),ad(f,()=>{if(e)return nH(am(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),am(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),ad(f,()=>am(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",l)})),ad(f,()=>am(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),ad(f,()=>am(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),ad(f,()=>ap(f,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;let{activeId:r}=f.getState(),n=o.item(r);f.setState("activeValue",null==n?void 0:n.value)})),{...s,...o,...f,tag:e,setValue:e=>f.setState("value",e),resetValue:()=>f.setState("value",d.value),setSelectedValue:e=>f.setState("selectedValue",e)}}function sk(e={}){var t,r,n,i,a,o,s,l;let u;t=e,u=sD();let[c,d]=aO(sH,e={id:n6((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return n7(d,[(n=e).tag]),aL(c,n,"value","setValue"),aL(c,n,"selectedValue","setSelectedValue"),aL(c,n,"resetValueOnHide"),aL(c,n,"resetValueOnSelect"),Object.assign((o=c,n7(s=d,[(l=n).popover]),aL(o,l,"placement"),i=of(o,s,l),a=i,n7(d,[n.store]),aL(a,n,"items","setItems"),aL(i=a,n,"activeId","setActiveId"),aL(i,n,"includesBaseElement"),aL(i,n,"virtualFocus"),aL(i,n,"orientation"),aL(i,n,"rtl"),aL(i,n,"focusLoop"),aL(i,n,"focusWrap"),aL(i,n,"focusShift"),i),{tag:n.tag})}function sU(e={}){let t=sk(e);return(0,d.jsx)(aa,{value:t,children:e.children})}var sj=(0,h.createContext)(void 0),sN=ip(function(e){let[t,r]=(0,h.useState)();return nJ(e={role:"group","aria-labelledby":t,...e=ir(e,e=>(0,d.jsx)(sj.Provider,{value:r,children:e}),[])})});id(function(e){return im("div",sN(e))});var sJ=ip(function({store:e,...t}){return sN(t)});id(function(e){return im("div",sJ(e))});var sK=ip(function({store:e,...t}){let r=an();return nU(e=e||r,!1),"grid"===nw(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=sJ({store:e,...t})}),sQ=id(function(e){return im("div",sK(e))}),sV=ip(function(e){let t=(0,h.useContext)(sj),r=n6(e.id);return n5(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),nJ(e={id:r,"aria-hidden":!0,...e})});id(function(e){return im("div",sV(e))});var sq=ip(function({store:e,...t}){return sV(t)});id(function(e){return im("div",sq(e))});var sX=ip(function(e){return sq(e)}),sW=id(function(e){return im("div",sX(e))}),sY=e.i(38360);let sz={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},sZ=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function s$(e,t,r={}){let{keys:n,threshold:i=sz.MATCHES,baseSort:a=sZ,sorter:o=e=>e.sort((e,t)=>(function(e,t,r){let{rank:n,keyIndex:i}=e,{rank:a,keyIndex:o}=t;return n!==a?n>a?-1:1:i===o?r(e,t):i<o?-1:1})(e,t,a))}=r;return o(e.reduce(function(e,a,o){var s,l,u,c;let d=(s=a,l=n,u=t,c=r,l?(function(e,t){let r=[];for(let i=0,a=t.length;i<a;i++){var n;let a=t[i],o="string"==typeof(n=a)?s2:{...s2,...n},s=function(e,t){let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else{if(t.includes("."))return function(e,t){let r=e.split("."),n=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=[];for(let e=0,r=n.length;e<r;e++){let r=n[e];if(null!=r)if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&i.push(e)}else"*"===t&&(i=i.concat(r))}n=i}return Array.isArray(n[0])?[].concat(...n):n}(t,e);r=null}return null==r?[]:Array.isArray(r)?r:[String(r)]}(e,a);for(let e=0,t=s.length;e<t;e++)r.push({itemValue:s[e],attributes:o})}return r})(s,l).reduce(({rank:e,rankedValue:t,keyIndex:r,keyThreshold:n},{itemValue:i,attributes:a},o)=>{let s=s0(i,u,c),l=t,{minRanking:d,maxRanking:f,threshold:h}=a;return s<d&&s>=sz.MATCHES?s=d:s>f&&(s=f),s>e&&(e=s,r=o,n=h,l=i),{rankedValue:l,rank:e,keyIndex:r,keyThreshold:n}},{rankedValue:s,rank:sz.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:s0(s,u,c),keyIndex:-1,keyThreshold:c.threshold}),{rank:f,keyThreshold:h=i}=d;return f>=h&&e.push({...d,item:a,index:o}),e},[])).map(({item:e})=>e)}function s0(e,t,r){if(e=s1(e,r),(t=s1(t,r)).length>e.length)return sz.NO_MATCH;if(e===t)return sz.CASE_SENSITIVE_EQUAL;let n=function*(e,t){let r=-1;for(;(r=e.indexOf(t,r+1))>-1;)yield r;return -1}(e=e.toLowerCase(),t=t.toLowerCase()),i=n.next(),a=i.value;if(e.length===t.length&&0===a)return sz.EQUAL;if(0===a)return sz.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return sz.WORD_STARTS_WITH;o=n.next()}return a>0?sz.CONTAINS:1===t.length?sz.NO_MATCH:(function(e){let t="",r=" ";for(let n=0;n<e.length;n++){let i=e.charAt(n),a=" "===i||"-"===i;" "!==r&&"-"!==r||a||(t+=i),r=i}return t})(e).includes(t)?sz.ACRONYM:function(e,t){var r;let n,i=0,a=0;function o(e,t,r){for(let n=r,a=t.length;n<a;n++)if(t[n]===e)return i+=1,n+1;return -1}let s=o(t[0],e,0);if(s<0)return sz.NO_MATCH;a=s;for(let r=1,n=t.length;r<n;r++)if(!((a=o(t[r],e,a))>-1))return sz.NO_MATCH;return r=a-s,n=i/t.length,sz.MATCHES+1/r*n}(e,t)}function s1(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,sY.default)(e)),e}s$.rankings=sz;let s2={maxRanking:1/0,minRanking:-1/0};var s9=e.i(29402);let s3=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),s5={"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)"},s8={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},s4=(0,rQ.getMissionList)().filter(e=>!s3.has(e)).map(e=>{let t,r=(0,rQ.getMissionInfo)(e),[n]=(0,rQ.getSourceAndPath)(r.resourcePath),i=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",a=s5[n]??s8[i]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:a,missionTypes:r.missionTypes}}),s6=new Map(s4.map(e=>[e.missionName,e])),s7=function(e){let t=new Map;for(let r of e){let e=t.get(r.groupName)??[];e.push(r),t.set(r.groupName,e)}return t.forEach((e,r)=>{t.set(r,(0,s9.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,s9.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(s4),le="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function lt(e){let t,r,n,i,a,o=(0,f.c)(12),{mission:s}=e,l=s.displayName||s.missionName;return o[0]!==l?(t=(0,d.jsx)("span",{className:"MissionSelect-itemName",children:l}),o[0]=l,o[1]=t):t=o[1],o[2]!==s.missionTypes?(r=s.missionTypes.length>0&&(0,d.jsx)("span",{className:"MissionSelect-itemTypes",children:s.missionTypes.map(lr)}),o[2]=s.missionTypes,o[3]=r):r=o[3],o[4]!==t||o[5]!==r?(n=(0,d.jsxs)("span",{className:"MissionSelect-itemHeader",children:[t,r]}),o[4]=t,o[5]=r,o[6]=n):n=o[6],o[7]!==s.missionName?(i=(0,d.jsx)("span",{className:"MissionSelect-itemMissionName",children:s.missionName}),o[7]=s.missionName,o[8]=i):i=o[8],o[9]!==n||o[10]!==i?(a=(0,d.jsxs)(d.Fragment,{children:[n,i]}),o[9]=n,o[10]=i,o[11]=a):a=o[11],a}function lr(e){return(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e)}function ln(e){let t,r,n,i,a,o,s,l,u,c,m,p,A,g,v,C,B,y=(0,f.c)(43),{value:b,missionType:x,onChange:E}=e,[S,F]=(0,h.useState)(""),M=(0,h.useRef)(null),T=(0,h.useRef)(x);y[0]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{(0,h.startTransition)(()=>F(e))},y[0]=t):t=y[0];let R=sk({resetValueOnHide:!0,selectedValue:b,setSelectedValue:e=>{if(e){let t=T.current,r=(0,rQ.getMissionInfo)(e).missionTypes;t&&r.includes(t)||(t=r[0]),E({missionName:e,missionType:t}),M.current?.blur()}},setValue:t});y[1]!==R?(r=()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),M.current?.focus(),R.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},n=[R],y[1]=R,y[2]=r,y[3]=n):(r=y[2],n=y[3]),(0,h.useEffect)(r,n),y[4]!==b?(i=s6.get(b),y[4]=b,y[5]=i):i=y[5];let w=i;e:{let e,t;if(!S){let e;y[6]===Symbol.for("react.memo_cache_sentinel")?(e={type:"grouped",groups:s7},y[6]=e):e=y[6],a=e;break e}y[7]!==S?(e=s$(s4,S,{keys:["displayName","missionName","missionTypes","groupName"]}),y[7]=S,y[8]=e):e=y[8];let r=e;y[9]!==r?(t={type:"flat",missions:r},y[9]=r,y[10]=t):t=y[10],a=t}let D=a,I=w?w.displayName||w.missionName:b,G="flat"===D.type?0===D.missions.length:0===D.groups.length,L=e=>(0,d.jsx)(ak,{value:e.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:t=>{if(t.target&&t.target instanceof HTMLElement){let r=t.target.dataset.missionType;r?(T.current=r,e.missionName===b&&E({missionName:e.missionName,missionType:r})):T.current=null}else T.current=null},children:(0,d.jsx)(lt,{mission:e})},e.missionName);y[11]!==R?(o=()=>{document.exitPointerLock(),R.show()},s=e=>{"Escape"!==e.key||R.getState().open||M.current?.blur()},y[11]=R,y[12]=o,y[13]=s):(o=y[12],s=y[13]),y[14]!==I||y[15]!==o||y[16]!==s?(l=(0,d.jsx)(ab,{ref:M,autoSelect:!0,placeholder:I,className:"MissionSelect-input",onFocus:o,onKeyDown:s}),y[14]=I,y[15]=o,y[16]=s,y[17]=l):l=y[17],y[18]!==I?(u=(0,d.jsx)("span",{className:"MissionSelect-selectedName",children:I}),y[18]=I,y[19]=u):u=y[19],y[20]!==x?(c=x&&(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":x,children:x}),y[20]=x,y[21]=c):c=y[21],y[22]!==c||y[23]!==u?(m=(0,d.jsxs)("div",{className:"MissionSelect-selectedValue",children:[u,c]}),y[22]=c,y[23]=u,y[24]=m):m=y[24],y[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,d.jsx)("kbd",{className:"MissionSelect-shortcut",children:le?"⌘K":"^K"}),y[25]=p):p=y[25],y[26]!==m||y[27]!==l?(A=(0,d.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[l,m,p]}),y[26]=m,y[27]=l,y[28]=A):A=y[28];let O="flat"===D.type?D.missions.map(L):D.groups.map(e=>{let[t,r]=e;return t?(0,d.jsxs)(sQ,{className:"MissionSelect-group",children:[(0,d.jsx)(sW,{className:"MissionSelect-groupLabel",children:t}),r.map(L)]},t):(0,d.jsx)(h.Fragment,{children:r.map(L)},"ungrouped")});return y[29]!==G?(g=G&&(0,d.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"}),y[29]=G,y[30]=g):g=y[30],y[31]!==aq||y[32]!==O||y[33]!==g?(v=(0,d.jsxs)(aq,{className:"MissionSelect-list",children:[O,g]}),y[31]=aq,y[32]=O,y[33]=g,y[34]=v):v=y[34],y[35]!==sR||y[36]!==v?(C=(0,d.jsx)(sR,{gutter:4,fitViewport:!0,autoFocusOnHide:!1,className:"MissionSelect-popover",children:v}),y[35]=sR,y[36]=v,y[37]=C):C=y[37],y[38]!==sU||y[39]!==R||y[40]!==A||y[41]!==C?(B=(0,d.jsxs)(sU,{store:R,children:[A,C]}),y[38]=sU,y[39]=R,y[40]=A,y[41]=C,y[42]=B):B=y[42],B}var li={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},la=h.default.createContext&&h.default.createContext(li),lo=["attr","size","title"];function ls(){return(ls=Object.assign.bind()).apply(this,arguments)}function ll(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function lu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ll(Object(r),!0).forEach(function(t){var n,i,a;n=e,i=t,a=r[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in n?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ll(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lc(e){return t=>h.default.createElement(ld,ls({attr:lu({},e.attr)},t),function e(t){return t&&t.map((t,r)=>h.default.createElement(t.tag,lu({key:r},t.attr),e(t.child)))}(e.child))}function ld(e){var t=t=>{var r,{attr:n,size:i,title:a}=e,o=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,lo),s=i||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),h.default.createElement("svg",ls({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,o,{className:r,style:lu(lu({color:e.color||t.color},t.style),e.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),a&&h.default.createElement("title",null,a),e.children)};return void 0!==la?h.default.createElement(la.Consumer,null,e=>t(e)):t(li)}function lf(e){return lc({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)}function lh(e){return lc({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 lm(e){let t,r,n,i,a=(0,f.c)(7),{cameraRef:o}=e,[s,l]=(0,h.useState)(!1),u=(0,h.useRef)(null);a[0]!==o?(t=async()=>{clearTimeout(u.current);let e=o.current;if(!e)return;let t=function({position:e,quaternion:t}){let r=e=>parseFloat(e.toFixed(3)),n=`${r(e.x)},${r(e.y)},${r(e.z)}`,i=`${r(t.x)},${r(t.y)},${r(t.z)},${r(t.w)}`;return`#c${n}~${i}`}(e),r=`${window.location.pathname}${window.location.search}${t}`,n=`${window.location.origin}${r}`;window.history.replaceState(null,"",r);try{await navigator.clipboard.writeText(n),l(!0),u.current=setTimeout(()=>{l(!1)},1100)}catch(e){console.error(e)}},a[0]=o,a[1]=t):t=a[1];let c=t,m=s?"true":"false";return a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,d.jsx)(lf,{className:"MapPin"}),n=(0,d.jsx)(lh,{className:"ClipboardCheck"}),a[2]=r,a[3]=n):(r=a[2],n=a[3]),a[4]!==c||a[5]!==m?(i=(0,d.jsxs)("button",{type:"button",className:"IconButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:c,"data-copied":m,children:[r,n]}),a[4]=c,a[5]=m,a[6]=i):i=a[6],i}function lp(e){let t,r,n,i,a,o,s,l,u,c,h,m,p,A,g,v,C,B,y,b,x,E,S,F,M,T,R,w=(0,f.c)(64),{missionName:D,missionType:I,onChangeMission:G,cameraRef:L}=e,{fogEnabled:O,setFogEnabled:_,fov:P,setFov:H,audioEnabled:k,setAudioEnabled:U,animationEnabled:j,setAnimationEnabled:N}=(0,eM.useSettings)(),{speedMultiplier:J,setSpeedMultiplier:K}=(0,eM.useControls)(),{debugMode:Q,setDebugMode:V}=(0,eM.useDebug)();return w[0]!==D||w[1]!==I||w[2]!==G?(t=(0,d.jsx)(ln,{value:D,missionType:I,onChange:G}),w[0]=D,w[1]=I,w[2]=G,w[3]=t):t=w[3],w[4]!==L?(r=(0,d.jsx)(lm,{cameraRef:L}),w[4]=L,w[5]=r):r=w[5],w[6]!==_?(n=e=>{_(e.target.checked)},w[6]=_,w[7]=n):n=w[7],w[8]!==O||w[9]!==n?(i=(0,d.jsx)("input",{id:"fogInput",type:"checkbox",checked:O,onChange:n}),w[8]=O,w[9]=n,w[10]=i):i=w[10],w[11]===Symbol.for("react.memo_cache_sentinel")?(a=(0,d.jsx)("label",{htmlFor:"fogInput",children:"Fog?"}),w[11]=a):a=w[11],w[12]!==i?(o=(0,d.jsxs)("div",{className:"CheckboxField",children:[i,a]}),w[12]=i,w[13]=o):o=w[13],w[14]!==U?(s=e=>{U(e.target.checked)},w[14]=U,w[15]=s):s=w[15],w[16]!==k||w[17]!==s?(l=(0,d.jsx)("input",{id:"audioInput",type:"checkbox",checked:k,onChange:s}),w[16]=k,w[17]=s,w[18]=l):l=w[18],w[19]===Symbol.for("react.memo_cache_sentinel")?(u=(0,d.jsx)("label",{htmlFor:"audioInput",children:"Audio?"}),w[19]=u):u=w[19],w[20]!==l?(c=(0,d.jsxs)("div",{className:"CheckboxField",children:[l,u]}),w[20]=l,w[21]=c):c=w[21],w[22]!==N?(h=e=>{N(e.target.checked)},w[22]=N,w[23]=h):h=w[23],w[24]!==j||w[25]!==h?(m=(0,d.jsx)("input",{id:"animationInput",type:"checkbox",checked:j,onChange:h}),w[24]=j,w[25]=h,w[26]=m):m=w[26],w[27]===Symbol.for("react.memo_cache_sentinel")?(p=(0,d.jsx)("label",{htmlFor:"animationInput",children:"Animation?"}),w[27]=p):p=w[27],w[28]!==m?(A=(0,d.jsxs)("div",{className:"CheckboxField",children:[m,p]}),w[28]=m,w[29]=A):A=w[29],w[30]!==V?(g=e=>{V(e.target.checked)},w[30]=V,w[31]=g):g=w[31],w[32]!==Q||w[33]!==g?(v=(0,d.jsx)("input",{id:"debugInput",type:"checkbox",checked:Q,onChange:g}),w[32]=Q,w[33]=g,w[34]=v):v=w[34],w[35]===Symbol.for("react.memo_cache_sentinel")?(C=(0,d.jsx)("label",{htmlFor:"debugInput",children:"Debug?"}),w[35]=C):C=w[35],w[36]!==v?(B=(0,d.jsxs)("div",{className:"CheckboxField",children:[v,C]}),w[36]=v,w[37]=B):B=w[37],w[38]===Symbol.for("react.memo_cache_sentinel")?(y=(0,d.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),w[38]=y):y=w[38],w[39]!==H?(b=e=>H(parseInt(e.target.value)),w[39]=H,w[40]=b):b=w[40],w[41]!==P||w[42]!==b?(x=(0,d.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:P,onChange:b}),w[41]=P,w[42]=b,w[43]=x):x=w[43],w[44]!==P?(E=(0,d.jsx)("output",{htmlFor:"speedInput",children:P}),w[44]=P,w[45]=E):E=w[45],w[46]!==x||w[47]!==E?(S=(0,d.jsxs)("div",{className:"Field",children:[y,x,E]}),w[46]=x,w[47]=E,w[48]=S):S=w[48],w[49]===Symbol.for("react.memo_cache_sentinel")?(F=(0,d.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),w[49]=F):F=w[49],w[50]!==K?(M=e=>K(parseFloat(e.target.value)),w[50]=K,w[51]=M):M=w[51],w[52]!==J||w[53]!==M?(T=(0,d.jsxs)("div",{className:"Field",children:[F,(0,d.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:J,onChange:M})]}),w[52]=J,w[53]=M,w[54]=T):T=w[54],w[55]!==t||w[56]!==c||w[57]!==A||w[58]!==B||w[59]!==r||w[60]!==S||w[61]!==T||w[62]!==o?(R=(0,d.jsxs)("div",{id:"controls",onKeyDown:lv,onPointerDown:lg,onClick:lA,children:[t,r,o,c,A,B,S,T]}),w[55]=t,w[56]=c,w[57]=A,w[58]=B,w[59]=r,w[60]=S,w[61]=T,w[62]=o,w[63]=R):R=w[63],R}function lA(e){return e.stopPropagation()}function lg(e){return e.stopPropagation()}function lv(e){return e.stopPropagation()}let lC=h.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:i,...a},o)=>{let s=(0,ey.useThree)(({set:e})=>e),l=(0,ey.useThree)(({camera:e})=>e),u=(0,ey.useThree)(({size:e})=>e),c=h.useRef(null);h.useImperativeHandle(o,()=>c.current,[]);let d=h.useRef(null),f=function(e,t,r){let n=(0,ey.useThree)(e=>e.size),i=(0,ey.useThree)(e=>e.viewport),a="number"==typeof e?e:n.width*i.dpr,o=n.height*i.dpr,s=("number"==typeof e?void 0:e)||{},{samples:l=0,depth:u,...c}=s,d=null!=u?u:s.depthBuffer,f=h.useMemo(()=>{let e=new A.WebGLRenderTarget(a,o,{minFilter:A.LinearFilter,magFilter:A.LinearFilter,type:A.HalfFloatType,...c});return d&&(e.depthTexture=new A.DepthTexture(a,o,A.FloatType)),e.samples=l,e},[]);return h.useLayoutEffect(()=>{f.setSize(a,o),l&&(f.samples=l)},[l,f,a,o]),h.useEffect(()=>()=>f.dispose(),[]),f}(t);h.useLayoutEffect(()=>{a.manual||(c.current.aspect=u.width/u.height)},[u,a]),h.useLayoutEffect(()=>{c.current.updateProjectionMatrix()});let m=0,p=null,g="function"==typeof i;return(0,eB.useFrame)(t=>{g&&(r===1/0||m<r)&&(d.current.visible=!1,t.gl.setRenderTarget(f),p=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,c.current),t.scene.background=p,t.gl.setRenderTarget(null),d.current.visible=!0,m++)}),h.useLayoutEffect(()=>{if(n)return s(()=>({camera:c.current})),()=>s(()=>({camera:l}))},[c,n,s]),h.createElement(h.Fragment,null,h.createElement("perspectiveCamera",(0,eY.default)({ref:c},a),!g&&i),h.createElement("group",{ref:d},g&&i(f.texture)))});function lB(){let e,t,r=(0,f.c)(3),{fov:n}=(0,eM.useSettings)();return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=[0,256,0],r[0]=e):e=r[0],r[1]!==n?(t=(0,d.jsx)(lC,{makeDefault:!0,position:e,fov:n}),r[1]=n,r[2]=t):t=r[2],t}var ly=e.i(51434),lb=e.i(81405);function lx(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function lE({showPanel:e=0,className:t,parent:r}){let n=function(e,t=[],r){let[n,i]=h.useState();return h.useLayoutEffect(()=>{let t=e();return i(t),lx(void 0,t),()=>lx(void 0,null)},t),n}(()=>new lb.default,[]);return h.useEffect(()=>{if(n){let i=r&&r.current||document.body;n.showPanel(e),null==i||i.appendChild(n.dom);let a=(null!=t?t:"").split(" ").filter(e=>e);a.length&&n.dom.classList.add(...a);let o=(0,m.j)(()=>n.begin()),s=(0,m.k)(()=>n.end());return()=>{a.length&&n.dom.classList.remove(...a),null==i||i.removeChild(n.dom),o(),s()}}},[r,n,t,e]),null}var lS=e.i(60099);function lF(){let e,t,r=(0,f.c)(3),{debugMode:n}=(0,eM.useDebug)(),i=(0,h.useRef)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=i.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")},r[0]=e):e=r[0],(0,h.useEffect)(e),r[1]!==n?(t=n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(lE,{className:"StatsPanel"}),(0,d.jsx)("axesHelper",{ref:i,args:[70],renderOrder:999,children:(0,d.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,d.jsx)(lS.Html,{position:[80,0,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,d.jsx)(lS.Html,{position:[0,80,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,d.jsx)(lS.Html,{position:[0,0,80],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null,r[1]=n,r[2]=t):t=r[2],t}var lM=e.i(50361),lT=e.i(24540);function lR(e,t,r){try{return e(t)}catch(e){return(0,lT.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function lw(e){function t(t){if(void 0===t)return null;let r="";if(Array.isArray(t)){if(void 0===t[0])return null;r=t[0]}return"string"==typeof t&&(r=t),lR(e.parse,r)}return{type:"single",eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide:r=>t(r)??e}},withOptions(e){return{...this,...e}}}}function lD(e,t){return e.valueOf()===t.valueOf()}lw({parse:e=>e,serialize:String}),lw({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),lw({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),lw({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(1&t.length?"0":"")+t}}),lw({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),lw({parse:e=>"true"===e.toLowerCase(),serialize:String}),lw({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:lD}),lw({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:lD}),lw({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:lD});let lI=(0,lM.r)(),lG={};function lL(e,t,r,n,i,a){let o=!1,s=Object.entries(e).reduce((e,[s,l])=>{var u;let c=t?.[s]??s,d=n[c],f="multi"===l.type?[]:null,h=void 0===d?("multi"===l.type?r?.getAll(c):r?.get(c))??f:d;return i&&a&&((u=i[c]??f)===h||null!==u&&null!==h&&"string"!=typeof u&&"string"!=typeof h&&u.length===h.length&&u.every((e,t)=>e===h[t]))?e[s]=a[s]??null:(o=!0,e[s]=((0,lM.i)(h)?null:lR(l.parse,h,c))??null,i&&(i[c]=h)),e},{});if(!o){let t=Object.keys(e),r=Object.keys(a??{});o=t.length!==r.length||t.some(e=>!r.includes(e))}return{state:s,hasChanged:o}}function lO(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}let l_=new r2,lP={toneMapping:A.NoToneMapping,outputColorSpace:A.SRGBColorSpace},lH=lw({parse(e){let[t,r]=e.split("~"),n=r,i=(0,rQ.getMissionInfo)(t).missionTypes;return r&&i.includes(r)||(n=i[0]),{missionName:t,missionType:n}},serialize:({missionName:e,missionType:t})=>1===(0,rQ.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function lk(){let e,t,r,n,i,a,o,s,l,u,c,m,p,g,v,C,B,y,x,E=(0,f.c)(40),[S,F]=function(e,t={}){let{parse:r,type:n,serialize:i,eq:a,defaultValue:o,...s}=t,[{[e]:l},u]=function(e,t={}){let r=(0,h.useId)(),n=(0,lT.i)(),i=(0,lT.a)(),{history:a="replace",scroll:o=n?.scroll??!1,shallow:s=n?.shallow??!0,throttleMs:l=lM.s.timeMs,limitUrlUpdates:u=n?.limitUrlUpdates,clearOnDefault:c=n?.clearOnDefault??!0,startTransition:d,urlKeys:f=lG}=t,m=Object.keys(e).join(","),p=(0,h.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,f[e]??e])),[m,JSON.stringify(f)]),A=(0,lT.r)(Object.values(p)),g=A.searchParams,v=(0,h.useRef)({}),C=(0,h.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),B=lM.t.useQueuedQueries(Object.values(p)),[y,b]=(0,h.useState)(()=>lL(e,f,g??new URLSearchParams,B).state),x=(0,h.useRef)(y);if((0,lT.c)("[nuq+ %s `%s`] render - state: %O, iSP: %s",r,m,y,g),Object.keys(v.current).join("&")!==Object.values(p).join("&")){let{state:t,hasChanged:n}=lL(e,f,g,B,v.current,x.current);n&&((0,lT.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:g,queuedQueries:B,queryRef:v.current,stateRef:x.current}),x.current=t,b(t)),v.current=Object.fromEntries(Object.entries(p).map(([t,r])=>[r,e[t]?.type==="multi"?g?.getAll(r):g?.get(r)??null]))}(0,h.useEffect)(()=>{let{state:t,hasChanged:n}=lL(e,f,g,B,v.current,x.current);n&&((0,lT.c)("[nuq+ %s `%s`] State changed: %O",r,m,{state:t,initialSearchParams:g,queuedQueries:B,queryRef:v.current,stateRef:x.current}),x.current=t,b(t))},[Object.values(p).map(e=>`${e}=${g?.getAll(e)}`).join("&"),JSON.stringify(B)]),(0,h.useEffect)(()=>{let t=Object.keys(e).reduce((t,n)=>(t[n]=({state:t,query:i})=>{b(a=>{let{defaultValue:o}=e[n],s=p[n],l=t??o??null;return Object.is(a[n]??o??null,l)?((0,lT.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",r,m,s,t,o,x.current),a):(x.current={...x.current,[n]:l},v.current[s]=i,(0,lT.c)("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",r,m,s,t,o,x.current),x.current)})},t),{});for(let n of Object.keys(e)){let e=p[n];(0,lT.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,m),lI.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=p[n];(0,lT.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,m),lI.off(e,t[n])}}},[m,p]);let E=(0,h.useCallback)((t,n={})=>{let f,h=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g="function"==typeof t?t(lO(x.current,C))??h:t??h;(0,lT.c)("[nuq+ %s `%s`] setState: %O",r,m,g);let v=0,B=!1,y=[];for(let[t,r]of Object.entries(g)){let h=e[t],m=p[t];if(!h||void 0===r)continue;(n.clearOnDefault??h.clearOnDefault??c)&&null!==r&&void 0!==h.defaultValue&&(h.eq??((e,t)=>e===t))(r,h.defaultValue)&&(r=null);let g=null===r?null:(h.serialize??String)(r);lI.emit(m,{state:r,query:g});let C={key:m,query:g,options:{history:n.history??h.history??a,shallow:n.shallow??h.shallow??s,scroll:n.scroll??h.scroll??o,startTransition:n.startTransition??h.startTransition??d}};if(n?.limitUrlUpdates?.method==="debounce"||u?.method==="debounce"||h.limitUrlUpdates?.method==="debounce"){!0===C.options.shallow&&console.warn((0,lT.s)(422));let e=n?.limitUrlUpdates?.timeMs??u?.timeMs??h.limitUrlUpdates?.timeMs??lM.s.timeMs,t=lM.t.push(C,e,A,i);v<e&&(f=t,v=e)}else{let e=n?.limitUrlUpdates?.timeMs??h?.limitUrlUpdates?.timeMs??u?.timeMs??n.throttleMs??h.throttleMs??l;y.push(lM.t.abort(m)),lM.n.push(C,e),B=!0}}let b=y.reduce((e,t)=>t(e),B?lM.n.flush(A,i):lM.n.getPendingPromise(A));return f??b},[m,a,s,o,l,u?.method,u?.timeMs,d,p,A.updateUrl,A.getSearchParamsSnapshot,A.rateLimitFactor,i,C]);return[(0,h.useMemo)(()=>lO(y,C),[y,C]),E]}({[e]:{parse:r??(e=>e),type:n,serialize:i,eq:a,defaultValue:o}},s);return[l,(0,h.useCallback)((t,r={})=>u(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,u])]}("mission",lH);E[0]!==F?(e=e=>{window.location.hash="",F(e)},E[0]=F,E[1]=e):e=E[1];let M=e,T=function(){let e,t,r=(0,f.c)(2),[n,i]=(0,h.useState)(null);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=window.matchMedia("(pointer: coarse) and (hover: none)");i(e.matches);let t=e=>{i(e.matches)};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},t=[],r[0]=e,r[1]=t):(e=r[0],t=r[1]),(0,h.useEffect)(e,t),n}(),{missionName:R,missionType:w}=S,[D,I]=(0,h.useState)(0),[G,L]=(0,h.useState)(!0),O=D<1;E[2]!==O?(t=()=>{if(O)L(!0);else{let e=setTimeout(()=>L(!1),500);return()=>clearTimeout(e)}},r=[O],E[2]=O,E[3]=t,E[4]=r):(t=E[3],r=E[4]),(0,h.useEffect)(t,r),E[5]!==M?(n=()=>(window.setMissionName=e=>{let t=(0,rQ.getMissionInfo)(e).missionTypes;M({missionName:e,missionType:t[0]})},window.getMissionList=rQ.getMissionList,window.getMissionInfo=rQ.getMissionInfo,lU),i=[M],E[5]=M,E[6]=n,E[7]=i):(n=E[6],i=E[7]),(0,h.useEffect)(n,i),E[8]===Symbol.for("react.memo_cache_sentinel")?(a=(e,t)=>{I(void 0===t?0:t)},E[8]=a):a=E[8];let _=a,P=(0,h.useRef)(null);E[9]===Symbol.for("react.memo_cache_sentinel")?(o={angle:0,force:0},E[9]=o):o=E[9];let H=(0,h.useRef)(o),k=(0,h.useRef)(null);E[10]!==O||E[11]!==D||E[12]!==G?(s=G&&(0,d.jsxs)("div",{id:"loadingIndicator","data-complete":!O,children:[(0,d.jsx)("div",{className:"LoadingSpinner"}),(0,d.jsx)("div",{className:"LoadingProgress",children:(0,d.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*D}%`}})}),(0,d.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*D),"%"]})]}),E[10]=O,E[11]=D,E[12]=G,E[13]=s):s=E[13],E[14]!==T?(l=T&&(0,d.jsx)(nA,{joystickState:H,joystickZone:k}),E[14]=T,E[15]=l):l=E[15],E[16]===Symbol.for("react.memo_cache_sentinel")?(c={type:A.PCFShadowMap},u=e=>{P.current=e.camera},E[16]=u,E[17]=c):(u=E[16],c=E[17]);let U=`${R}~${w}`;return E[18]!==R||E[19]!==w||E[20]!==U?(m=(0,d.jsx)(rW,{name:R,missionType:w,onLoadingChange:_},U),E[18]=R,E[19]=w,E[20]=U,E[21]=m):m=E[21],E[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,d.jsx)(lB,{}),g=(0,d.jsx)(lF,{}),E[22]=p,E[23]=g):(p=E[22],g=E[23]),E[24]!==T?(v=null===T?null:T?(0,d.jsx)(ng,{joystickState:H,joystickZone:k}):(0,d.jsx)(nf,{}),E[24]=T,E[25]=v):v=E[25],E[26]!==m||E[27]!==v?(C=(0,d.jsx)(b,{frameloop:"always",gl:lP,shadows:c,onCreated:u,children:(0,d.jsx)(r_,{children:(0,d.jsxs)(ly.AudioProvider,{children:[m,p,g,v]})})}),E[26]=m,E[27]=v,E[28]=C):C=E[28],E[29]!==C||E[30]!==s||E[31]!==l?(B=(0,d.jsxs)("div",{id:"canvasContainer",children:[s,l,C]}),E[29]=C,E[30]=s,E[31]=l,E[32]=B):B=E[32],E[33]!==M||E[34]!==R||E[35]!==w?(y=(0,d.jsx)(lp,{missionName:R,missionType:w,onChangeMission:M,cameraRef:P}),E[33]=M,E[34]=R,E[35]=w,E[36]=y):y=E[36],E[37]!==B||E[38]!==y?(x=(0,d.jsx)(ef,{client:l_,children:(0,d.jsx)("main",{children:(0,d.jsxs)(eM.SettingsProvider,{children:[B,y]})})}),E[37]=B,E[38]=y,E[39]=x):x=E[39],x}function lU(){delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}function lj(){let e,t=(0,f.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,d.jsx)(h.Suspense,{children:(0,d.jsx)(lk,{})}),t[0]=e):e=t[0],e}e.s(["default",()=>lj],31713)}]);