mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-01-19 20:25:01 +00:00
528 lines
322 KiB
JavaScript
528 lines
322 KiB
JavaScript
(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]",M="[object DataView]",S=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/,T=/^\./,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,w=/\\(\\)?/g,D=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,G={};G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G[u]=G[c]=G[E]=G[d]=G[M]=G[f]=G[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,P=L||O||Function("return this")(),H=r&&!r.nodeType&&r,_=H&&t&&!t.nodeType&&t,k=_&&_.exports===H&&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=P["__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=P.Symbol,en=P.Uint8Array,ei=W.propertyIsEnumerable,ea=q.splice,eo=(a=Object.keys,o=Object,function(e){return a(o(e))}),es=eO(P,"DataView"),el=eO(P,"Map"),eu=eO(P,"Promise"),ec=eO(P,"Set"),ed=eO(P,"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 eM(e){this.__data__=new eb(e)}function eS(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=eS(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=eS(t,e);return r<0?void 0:t[r][1]},eb.prototype.has=function(e){return eS(this.__data__,e)>-1},eb.prototype.set=function(e,t){var r=this.__data__,n=eS(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},ex.prototype.clear=function(){this.__data__={hash:new ey,map:new(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)},eM.prototype.clear=function(){this.__data__=new eb},eM.prototype.delete=function(e){return this.__data__.delete(e)},eM.prototype.get=function(e){return this.__data__.get(e)},eM.prototype.has=function(e){return this.__data__.has(e)},eM.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eb){var n=r.__data__;if(!el||n.length<199)return n.push([e,t]),this;r=this.__data__=new ex(n)}return r.set(e,t),this};var eF=(n=function(e,t){return e&&eT(e,t,e0)},function(e,t){if(null==e)return e;if(!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=e_(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=eP(e))==u?g:l),s||(m=(m=eP(t))==u?g:m);var v=l==g&&!K(e),x=m==g&&!K(t),S=l==m;if(S&&!v)return a||(a=new eM),o||e$(e)?eG(e,t,r,n,i,a):function(e,t,r,n,i,a,o){switch(r){case M: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 F=v&&$.call(e,"__wrapped__"),T=x&&$.call(t,"__wrapped__");if(F||T){var R=F?e.value():e,w=T?t.value():t;return a||(a=new eM),r(R,w,n,i,a)}}return!!S&&(a||(a=new eM),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],e_(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=e_(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)&&eH(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 eM;if(!(void 0===c?eD(u,l,void 0,3,d):c))return!1}}return!0}(e,0,i)}:function(e){var t;return e_(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 eP=function(e){return ee.call(e)};function eH(e,t){return!!(t=null==t?0x1fffffffffffff:t)&&("number"==typeof e||I.test(e))&&e>-1&&e%1==0&&e<t}function e_(e,t){if(eV(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||eZ(e))||F.test(e)||!S.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&&eP(new es(new ArrayBuffer(1)))!=M||el&&eP(new el)!=p||eu&&eP(eu.resolve())!=v||ec&&eP(new ec)!=B||ed&&eP(new ed)!=x)&&(eP=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 M;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||eH(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):[],eF(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(71645),h=e.i(91037),m=e.i(8560),p=e.i(90072);e.s(["ACESFilmicToneMapping",()=>p.ACESFilmicToneMapping,"AddEquation",()=>p.AddEquation,"AddOperation",()=>p.AddOperation,"AdditiveAnimationBlendMode",()=>p.AdditiveAnimationBlendMode,"AdditiveBlending",()=>p.AdditiveBlending,"AgXToneMapping",()=>p.AgXToneMapping,"AlphaFormat",()=>p.AlphaFormat,"AlwaysCompare",()=>p.AlwaysCompare,"AlwaysDepth",()=>p.AlwaysDepth,"AlwaysStencilFunc",()=>p.AlwaysStencilFunc,"AmbientLight",()=>p.AmbientLight,"AnimationAction",()=>p.AnimationAction,"AnimationClip",()=>p.AnimationClip,"AnimationLoader",()=>p.AnimationLoader,"AnimationMixer",()=>p.AnimationMixer,"AnimationObjectGroup",()=>p.AnimationObjectGroup,"AnimationUtils",()=>p.AnimationUtils,"ArcCurve",()=>p.ArcCurve,"ArrayCamera",()=>p.ArrayCamera,"ArrowHelper",()=>p.ArrowHelper,"AttachedBindMode",()=>p.AttachedBindMode,"Audio",()=>p.Audio,"AudioAnalyser",()=>p.AudioAnalyser,"AudioContext",()=>p.AudioContext,"AudioListener",()=>p.AudioListener,"AudioLoader",()=>p.AudioLoader,"AxesHelper",()=>p.AxesHelper,"BackSide",()=>p.BackSide,"BasicDepthPacking",()=>p.BasicDepthPacking,"BasicShadowMap",()=>p.BasicShadowMap,"BatchedMesh",()=>p.BatchedMesh,"Bone",()=>p.Bone,"BooleanKeyframeTrack",()=>p.BooleanKeyframeTrack,"Box2",()=>p.Box2,"Box3",()=>p.Box3,"Box3Helper",()=>p.Box3Helper,"BoxGeometry",()=>p.BoxGeometry,"BoxHelper",()=>p.BoxHelper,"BufferAttribute",()=>p.BufferAttribute,"BufferGeometry",()=>p.BufferGeometry,"BufferGeometryLoader",()=>p.BufferGeometryLoader,"ByteType",()=>p.ByteType,"Cache",()=>p.Cache,"Camera",()=>p.Camera,"CameraHelper",()=>p.CameraHelper,"CanvasTexture",()=>p.CanvasTexture,"CapsuleGeometry",()=>p.CapsuleGeometry,"CatmullRomCurve3",()=>p.CatmullRomCurve3,"CineonToneMapping",()=>p.CineonToneMapping,"CircleGeometry",()=>p.CircleGeometry,"ClampToEdgeWrapping",()=>p.ClampToEdgeWrapping,"Clock",()=>p.Clock,"Color",()=>p.Color,"ColorKeyframeTrack",()=>p.ColorKeyframeTrack,"ColorManagement",()=>p.ColorManagement,"CompressedArrayTexture",()=>p.CompressedArrayTexture,"CompressedCubeTexture",()=>p.CompressedCubeTexture,"CompressedTexture",()=>p.CompressedTexture,"CompressedTextureLoader",()=>p.CompressedTextureLoader,"ConeGeometry",()=>p.ConeGeometry,"ConstantAlphaFactor",()=>p.ConstantAlphaFactor,"ConstantColorFactor",()=>p.ConstantColorFactor,"Controls",()=>p.Controls,"CubeCamera",()=>p.CubeCamera,"CubeDepthTexture",()=>p.CubeDepthTexture,"CubeReflectionMapping",()=>p.CubeReflectionMapping,"CubeRefractionMapping",()=>p.CubeRefractionMapping,"CubeTexture",()=>p.CubeTexture,"CubeTextureLoader",()=>p.CubeTextureLoader,"CubeUVReflectionMapping",()=>p.CubeUVReflectionMapping,"CubicBezierCurve",()=>p.CubicBezierCurve,"CubicBezierCurve3",()=>p.CubicBezierCurve3,"CubicInterpolant",()=>p.CubicInterpolant,"CullFaceBack",()=>p.CullFaceBack,"CullFaceFront",()=>p.CullFaceFront,"CullFaceFrontBack",()=>p.CullFaceFrontBack,"CullFaceNone",()=>p.CullFaceNone,"Curve",()=>p.Curve,"CurvePath",()=>p.CurvePath,"CustomBlending",()=>p.CustomBlending,"CustomToneMapping",()=>p.CustomToneMapping,"CylinderGeometry",()=>p.CylinderGeometry,"Cylindrical",()=>p.Cylindrical,"Data3DTexture",()=>p.Data3DTexture,"DataArrayTexture",()=>p.DataArrayTexture,"DataTexture",()=>p.DataTexture,"DataTextureLoader",()=>p.DataTextureLoader,"DataUtils",()=>p.DataUtils,"DecrementStencilOp",()=>p.DecrementStencilOp,"DecrementWrapStencilOp",()=>p.DecrementWrapStencilOp,"DefaultLoadingManager",()=>p.DefaultLoadingManager,"DepthFormat",()=>p.DepthFormat,"DepthStencilFormat",()=>p.DepthStencilFormat,"DepthTexture",()=>p.DepthTexture,"DetachedBindMode",()=>p.DetachedBindMode,"DirectionalLight",()=>p.DirectionalLight,"DirectionalLightHelper",()=>p.DirectionalLightHelper,"DiscreteInterpolant",()=>p.DiscreteInterpolant,"DodecahedronGeometry",()=>p.DodecahedronGeometry,"DoubleSide",()=>p.DoubleSide,"DstAlphaFactor",()=>p.DstAlphaFactor,"DstColorFactor",()=>p.DstColorFactor,"DynamicCopyUsage",()=>p.DynamicCopyUsage,"DynamicDrawUsage",()=>p.DynamicDrawUsage,"DynamicReadUsage",()=>p.DynamicReadUsage,"EdgesGeometry",()=>p.EdgesGeometry,"EllipseCurve",()=>p.EllipseCurve,"EqualCompare",()=>p.EqualCompare,"EqualDepth",()=>p.EqualDepth,"EqualStencilFunc",()=>p.EqualStencilFunc,"EquirectangularReflectionMapping",()=>p.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>p.EquirectangularRefractionMapping,"Euler",()=>p.Euler,"EventDispatcher",()=>p.EventDispatcher,"ExternalTexture",()=>p.ExternalTexture,"ExtrudeGeometry",()=>p.ExtrudeGeometry,"FileLoader",()=>p.FileLoader,"Float16BufferAttribute",()=>p.Float16BufferAttribute,"Float32BufferAttribute",()=>p.Float32BufferAttribute,"FloatType",()=>p.FloatType,"Fog",()=>p.Fog,"FogExp2",()=>p.FogExp2,"FramebufferTexture",()=>p.FramebufferTexture,"FrontSide",()=>p.FrontSide,"Frustum",()=>p.Frustum,"FrustumArray",()=>p.FrustumArray,"GLBufferAttribute",()=>p.GLBufferAttribute,"GLSL1",()=>p.GLSL1,"GLSL3",()=>p.GLSL3,"GreaterCompare",()=>p.GreaterCompare,"GreaterDepth",()=>p.GreaterDepth,"GreaterEqualCompare",()=>p.GreaterEqualCompare,"GreaterEqualDepth",()=>p.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>p.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>p.GreaterStencilFunc,"GridHelper",()=>p.GridHelper,"Group",()=>p.Group,"HalfFloatType",()=>p.HalfFloatType,"HemisphereLight",()=>p.HemisphereLight,"HemisphereLightHelper",()=>p.HemisphereLightHelper,"IcosahedronGeometry",()=>p.IcosahedronGeometry,"ImageBitmapLoader",()=>p.ImageBitmapLoader,"ImageLoader",()=>p.ImageLoader,"ImageUtils",()=>p.ImageUtils,"IncrementStencilOp",()=>p.IncrementStencilOp,"IncrementWrapStencilOp",()=>p.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>p.InstancedBufferAttribute,"InstancedBufferGeometry",()=>p.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>p.InstancedInterleavedBuffer,"InstancedMesh",()=>p.InstancedMesh,"Int16BufferAttribute",()=>p.Int16BufferAttribute,"Int32BufferAttribute",()=>p.Int32BufferAttribute,"Int8BufferAttribute",()=>p.Int8BufferAttribute,"IntType",()=>p.IntType,"InterleavedBuffer",()=>p.InterleavedBuffer,"InterleavedBufferAttribute",()=>p.InterleavedBufferAttribute,"Interpolant",()=>p.Interpolant,"InterpolateDiscrete",()=>p.InterpolateDiscrete,"InterpolateLinear",()=>p.InterpolateLinear,"InterpolateSmooth",()=>p.InterpolateSmooth,"InterpolationSamplingMode",()=>p.InterpolationSamplingMode,"InterpolationSamplingType",()=>p.InterpolationSamplingType,"InvertStencilOp",()=>p.InvertStencilOp,"KeepStencilOp",()=>p.KeepStencilOp,"KeyframeTrack",()=>p.KeyframeTrack,"LOD",()=>p.LOD,"LatheGeometry",()=>p.LatheGeometry,"Layers",()=>p.Layers,"LessCompare",()=>p.LessCompare,"LessDepth",()=>p.LessDepth,"LessEqualCompare",()=>p.LessEqualCompare,"LessEqualDepth",()=>p.LessEqualDepth,"LessEqualStencilFunc",()=>p.LessEqualStencilFunc,"LessStencilFunc",()=>p.LessStencilFunc,"Light",()=>p.Light,"LightProbe",()=>p.LightProbe,"Line",()=>p.Line,"Line3",()=>p.Line3,"LineBasicMaterial",()=>p.LineBasicMaterial,"LineCurve",()=>p.LineCurve,"LineCurve3",()=>p.LineCurve3,"LineDashedMaterial",()=>p.LineDashedMaterial,"LineLoop",()=>p.LineLoop,"LineSegments",()=>p.LineSegments,"LinearFilter",()=>p.LinearFilter,"LinearInterpolant",()=>p.LinearInterpolant,"LinearMipMapLinearFilter",()=>p.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>p.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>p.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>p.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>p.LinearSRGBColorSpace,"LinearToneMapping",()=>p.LinearToneMapping,"LinearTransfer",()=>p.LinearTransfer,"Loader",()=>p.Loader,"LoaderUtils",()=>p.LoaderUtils,"LoadingManager",()=>p.LoadingManager,"LoopOnce",()=>p.LoopOnce,"LoopPingPong",()=>p.LoopPingPong,"LoopRepeat",()=>p.LoopRepeat,"MOUSE",()=>p.MOUSE,"Material",()=>p.Material,"MaterialLoader",()=>p.MaterialLoader,"MathUtils",()=>p.MathUtils,"Matrix2",()=>p.Matrix2,"Matrix3",()=>p.Matrix3,"Matrix4",()=>p.Matrix4,"MaxEquation",()=>p.MaxEquation,"Mesh",()=>p.Mesh,"MeshBasicMaterial",()=>p.MeshBasicMaterial,"MeshDepthMaterial",()=>p.MeshDepthMaterial,"MeshDistanceMaterial",()=>p.MeshDistanceMaterial,"MeshLambertMaterial",()=>p.MeshLambertMaterial,"MeshMatcapMaterial",()=>p.MeshMatcapMaterial,"MeshNormalMaterial",()=>p.MeshNormalMaterial,"MeshPhongMaterial",()=>p.MeshPhongMaterial,"MeshPhysicalMaterial",()=>p.MeshPhysicalMaterial,"MeshStandardMaterial",()=>p.MeshStandardMaterial,"MeshToonMaterial",()=>p.MeshToonMaterial,"MinEquation",()=>p.MinEquation,"MirroredRepeatWrapping",()=>p.MirroredRepeatWrapping,"MixOperation",()=>p.MixOperation,"MultiplyBlending",()=>p.MultiplyBlending,"MultiplyOperation",()=>p.MultiplyOperation,"NearestFilter",()=>p.NearestFilter,"NearestMipMapLinearFilter",()=>p.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>p.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>p.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>p.NearestMipmapNearestFilter,"NeutralToneMapping",()=>p.NeutralToneMapping,"NeverCompare",()=>p.NeverCompare,"NeverDepth",()=>p.NeverDepth,"NeverStencilFunc",()=>p.NeverStencilFunc,"NoBlending",()=>p.NoBlending,"NoColorSpace",()=>p.NoColorSpace,"NoNormalPacking",()=>p.NoNormalPacking,"NoToneMapping",()=>p.NoToneMapping,"NormalAnimationBlendMode",()=>p.NormalAnimationBlendMode,"NormalBlending",()=>p.NormalBlending,"NormalGAPacking",()=>p.NormalGAPacking,"NormalRGPacking",()=>p.NormalRGPacking,"NotEqualCompare",()=>p.NotEqualCompare,"NotEqualDepth",()=>p.NotEqualDepth,"NotEqualStencilFunc",()=>p.NotEqualStencilFunc,"NumberKeyframeTrack",()=>p.NumberKeyframeTrack,"Object3D",()=>p.Object3D,"ObjectLoader",()=>p.ObjectLoader,"ObjectSpaceNormalMap",()=>p.ObjectSpaceNormalMap,"OctahedronGeometry",()=>p.OctahedronGeometry,"OneFactor",()=>p.OneFactor,"OneMinusConstantAlphaFactor",()=>p.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>p.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>p.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>p.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>p.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>p.OneMinusSrcColorFactor,"OrthographicCamera",()=>p.OrthographicCamera,"PCFShadowMap",()=>p.PCFShadowMap,"PCFSoftShadowMap",()=>p.PCFSoftShadowMap,"PMREMGenerator",()=>m.PMREMGenerator,"Path",()=>p.Path,"PerspectiveCamera",()=>p.PerspectiveCamera,"Plane",()=>p.Plane,"PlaneGeometry",()=>p.PlaneGeometry,"PlaneHelper",()=>p.PlaneHelper,"PointLight",()=>p.PointLight,"PointLightHelper",()=>p.PointLightHelper,"Points",()=>p.Points,"PointsMaterial",()=>p.PointsMaterial,"PolarGridHelper",()=>p.PolarGridHelper,"PolyhedronGeometry",()=>p.PolyhedronGeometry,"PositionalAudio",()=>p.PositionalAudio,"PropertyBinding",()=>p.PropertyBinding,"PropertyMixer",()=>p.PropertyMixer,"QuadraticBezierCurve",()=>p.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>p.QuadraticBezierCurve3,"Quaternion",()=>p.Quaternion,"QuaternionKeyframeTrack",()=>p.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>p.QuaternionLinearInterpolant,"R11_EAC_Format",()=>p.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>p.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>p.RED_RGTC1_Format,"REVISION",()=>p.REVISION,"RG11_EAC_Format",()=>p.RG11_EAC_Format,"RGBADepthPacking",()=>p.RGBADepthPacking,"RGBAFormat",()=>p.RGBAFormat,"RGBAIntegerFormat",()=>p.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>p.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>p.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>p.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>p.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>p.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>p.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>p.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>p.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>p.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>p.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>p.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>p.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>p.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>p.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>p.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>p.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>p.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>p.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>p.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>p.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>p.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>p.RGBDepthPacking,"RGBFormat",()=>p.RGBFormat,"RGBIntegerFormat",()=>p.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>p.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>p.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>p.RGB_ETC1_Format,"RGB_ETC2_Format",()=>p.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>p.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>p.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>p.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>p.RGDepthPacking,"RGFormat",()=>p.RGFormat,"RGIntegerFormat",()=>p.RGIntegerFormat,"RawShaderMaterial",()=>p.RawShaderMaterial,"Ray",()=>p.Ray,"Raycaster",()=>p.Raycaster,"RectAreaLight",()=>p.RectAreaLight,"RedFormat",()=>p.RedFormat,"RedIntegerFormat",()=>p.RedIntegerFormat,"ReinhardToneMapping",()=>p.ReinhardToneMapping,"RenderTarget",()=>p.RenderTarget,"RenderTarget3D",()=>p.RenderTarget3D,"RepeatWrapping",()=>p.RepeatWrapping,"ReplaceStencilOp",()=>p.ReplaceStencilOp,"ReverseSubtractEquation",()=>p.ReverseSubtractEquation,"RingGeometry",()=>p.RingGeometry,"SIGNED_R11_EAC_Format",()=>p.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>p.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>p.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>p.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>p.SRGBColorSpace,"SRGBTransfer",()=>p.SRGBTransfer,"Scene",()=>p.Scene,"ShaderChunk",()=>m.ShaderChunk,"ShaderLib",()=>m.ShaderLib,"ShaderMaterial",()=>p.ShaderMaterial,"ShadowMaterial",()=>p.ShadowMaterial,"Shape",()=>p.Shape,"ShapeGeometry",()=>p.ShapeGeometry,"ShapePath",()=>p.ShapePath,"ShapeUtils",()=>p.ShapeUtils,"ShortType",()=>p.ShortType,"Skeleton",()=>p.Skeleton,"SkeletonHelper",()=>p.SkeletonHelper,"SkinnedMesh",()=>p.SkinnedMesh,"Source",()=>p.Source,"Sphere",()=>p.Sphere,"SphereGeometry",()=>p.SphereGeometry,"Spherical",()=>p.Spherical,"SphericalHarmonics3",()=>p.SphericalHarmonics3,"SplineCurve",()=>p.SplineCurve,"SpotLight",()=>p.SpotLight,"SpotLightHelper",()=>p.SpotLightHelper,"Sprite",()=>p.Sprite,"SpriteMaterial",()=>p.SpriteMaterial,"SrcAlphaFactor",()=>p.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>p.SrcAlphaSaturateFactor,"SrcColorFactor",()=>p.SrcColorFactor,"StaticCopyUsage",()=>p.StaticCopyUsage,"StaticDrawUsage",()=>p.StaticDrawUsage,"StaticReadUsage",()=>p.StaticReadUsage,"StereoCamera",()=>p.StereoCamera,"StreamCopyUsage",()=>p.StreamCopyUsage,"StreamDrawUsage",()=>p.StreamDrawUsage,"StreamReadUsage",()=>p.StreamReadUsage,"StringKeyframeTrack",()=>p.StringKeyframeTrack,"SubtractEquation",()=>p.SubtractEquation,"SubtractiveBlending",()=>p.SubtractiveBlending,"TOUCH",()=>p.TOUCH,"TangentSpaceNormalMap",()=>p.TangentSpaceNormalMap,"TetrahedronGeometry",()=>p.TetrahedronGeometry,"Texture",()=>p.Texture,"TextureLoader",()=>p.TextureLoader,"TextureUtils",()=>p.TextureUtils,"Timer",()=>p.Timer,"TimestampQuery",()=>p.TimestampQuery,"TorusGeometry",()=>p.TorusGeometry,"TorusKnotGeometry",()=>p.TorusKnotGeometry,"Triangle",()=>p.Triangle,"TriangleFanDrawMode",()=>p.TriangleFanDrawMode,"TriangleStripDrawMode",()=>p.TriangleStripDrawMode,"TrianglesDrawMode",()=>p.TrianglesDrawMode,"TubeGeometry",()=>p.TubeGeometry,"UVMapping",()=>p.UVMapping,"Uint16BufferAttribute",()=>p.Uint16BufferAttribute,"Uint32BufferAttribute",()=>p.Uint32BufferAttribute,"Uint8BufferAttribute",()=>p.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>p.Uint8ClampedBufferAttribute,"Uniform",()=>p.Uniform,"UniformsGroup",()=>p.UniformsGroup,"UniformsLib",()=>m.UniformsLib,"UniformsUtils",()=>p.UniformsUtils,"UnsignedByteType",()=>p.UnsignedByteType,"UnsignedInt101111Type",()=>p.UnsignedInt101111Type,"UnsignedInt248Type",()=>p.UnsignedInt248Type,"UnsignedInt5999Type",()=>p.UnsignedInt5999Type,"UnsignedIntType",()=>p.UnsignedIntType,"UnsignedShort4444Type",()=>p.UnsignedShort4444Type,"UnsignedShort5551Type",()=>p.UnsignedShort5551Type,"UnsignedShortType",()=>p.UnsignedShortType,"VSMShadowMap",()=>p.VSMShadowMap,"Vector2",()=>p.Vector2,"Vector3",()=>p.Vector3,"Vector4",()=>p.Vector4,"VectorKeyframeTrack",()=>p.VectorKeyframeTrack,"VideoFrameTexture",()=>p.VideoFrameTexture,"VideoTexture",()=>p.VideoTexture,"WebGL3DRenderTarget",()=>p.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>p.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>p.WebGLCoordinateSystem,"WebGLCubeRenderTarget",()=>p.WebGLCubeRenderTarget,"WebGLRenderTarget",()=>p.WebGLRenderTarget,"WebGLRenderer",()=>m.WebGLRenderer,"WebGLUtils",()=>m.WebGLUtils,"WebGPUCoordinateSystem",()=>p.WebGPUCoordinateSystem,"WebXRController",()=>p.WebXRController,"WireframeGeometry",()=>p.WireframeGeometry,"WrapAroundEnding",()=>p.WrapAroundEnding,"ZeroCurvatureEnding",()=>p.ZeroCurvatureEnding,"ZeroFactor",()=>p.ZeroFactor,"ZeroSlopeEnding",()=>p.ZeroSlopeEnding,"ZeroStencilOp",()=>p.ZeroStencilOp,"createCanvasElement",()=>p.createCanvasElement,"error",()=>p.error,"getConsoleFunction",()=>p.getConsoleFunction,"log",()=>p.log,"setConsoleFunction",()=>p.setConsoleFunction,"warn",()=>p.warn,"warnOnce",()=>p.warnOnce],32009);var A=e.i(32009);function g(e,t){let r;return(...n)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...n),t)}}let v=["x","y","top","bottom","left","right","width","height"];var C=e.i(46791);function B({ref:e,children:t,fallback:r,resize:n,style:i,gl:a,events:o=h.f,eventSource:s,eventPrefix:l,shadows:u,linear:c,flat:m,legacy:p,orthographic:C,frameloop:B,dpr:y,performance:b,raycaster:x,camera:E,scene:M,onPointerMissed:S,onCreated:F,...T}){f.useMemo(()=>(0,h.e)(A),[]);let R=(0,h.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,f.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,f.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=e?"number"==typeof e?e:e.scroll:null,h=e?"number"==typeof e?e:e.resize:null,m=(0,f.useRef)(!1);(0,f.useEffect)(()=>(m.current=!0,()=>void(m.current=!1)));let[p,A,C]=(0,f.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,!v.every(r=>e[r]===t[r]))&&u(c.current.lastBounds=h)};return[e,h?g(e,h):e,d?g(e,d):e]},[u,n,d,h]);function B(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",C,!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(C),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",C,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{C()},"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=C,a=!!t,(0,f.useEffect)(()=>{if(a)return window.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",i,!0)},[i,a]),o=A,(0,f.useEffect)(()=>(window.addEventListener("resize",o),()=>void window.removeEventListener("resize",o)),[o]),(0,f.useEffect)(()=>{B(),y()},[t,C,A]),(0,f.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=f.useRef(null),G=f.useRef(null);f.useImperativeHandle(e,()=>I.current);let L=(0,h.a)(S),[O,P]=f.useState(!1),[H,_]=f.useState(!1);if(O)throw O;if(H)throw H;let k=f.useRef(null);(0,h.b)(()=>{let e=I.current;D.width>0&&D.height>0&&e&&(k.current||(k.current=(0,h.c)(e)),async function(){await k.current.configure({gl:a,scene:M,events:o,shadows:u,linear:c,flat:m,legacy:p,orthographic:C,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,h.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==F||F(e)}}),k.current.render((0,d.jsx)(R,{children:(0,d.jsx)(h.E,{set:_,children:(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)(h.B,{set:P}),children:null!=t?t:null})})}))}())}),f.useEffect(()=>{let e=I.current;if(e)return()=>(0,h.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 y(e){return(0,d.jsx)(C.FiberProvider,{children:(0,d.jsx)(B,{...e})})}e.i(39695),e.i(98133),e.i(95087);var b=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 x={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},E=new class{#e=x;#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)}},M="undefined"==typeof window||"Deno"in globalThis;function S(){}function F(e){return"number"==typeof e&&e>=0&&e!==1/0}function T(e,t){return Math.max(e+(t||0)-Date.now(),0)}function R(e,t){return"function"==typeof e?e(t):e}function w(e,t){return"function"==typeof e?e(t):e}function D(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(n){if(t.queryHash!==G(o,t.options))return!1}else if(!O(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 I(e,t){let{exact:r,status:n,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(L(t.options.mutationKey)!==L(a))return!1}else if(!O(t.options.mutationKey,a))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function G(e,t){return(t?.queryKeyHashFn||L)(e)}function L(e){return JSON.stringify(e,(e,t)=>k(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function O(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).every(r=>O(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 _(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function k(e){if(!U(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!U(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function U(e){return"[object Object]"===Object.prototype.toString.call(e)}function j(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=_(t)&&_(r);if(!n&&!(k(t)&&k(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 N(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function J(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var K=Symbol();function Q(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==K?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}var V=new class extends b{#r;#n;#i;constructor(){super(),this.#i=e=>{if(!M&&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"}},q=(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}}),X=new class extends b{#a=!0;#n;#i;constructor(){super(),this.#i=e=>{if(!M&&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 W(){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 Y(e){return Math.min(1e3*2**e,3e4)}function z(e){return(e??"online")!=="online"||X.isOnline()}var Z=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function $(e){let t,r=!1,n=0,i=W(),a=()=>V.isFocused()&&("always"===e.networkMode||X.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*!M,s=e.retryDelay??Y,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=>{E.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 Z(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 ee=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),F(this.gcTime)&&(this.#o=E.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M?1/0:3e5))}clearGcTimeout(){this.#o&&(E.clearTimeout(this.#o),this.#o=void 0)}},et=class extends ee{#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=ei(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=ei(this.options);void 0!==e.data&&(this.setState(en(e.data,e.dataUpdatedAt)),this.#s=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){let r=j(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(S).catch(S):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#s)}isActive(){return this.observers.some(e=>!1!==w(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===K||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===R(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||!T(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=Q(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=$({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof Z&&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 Z){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,...er(t.data,this.options),fetchMeta:e.meta??null};case"success":let r={...t,...en(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"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}};this.state=t(this.state),q.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function er(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function en(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ei(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 ea=class extends b{constructor(e,t){super(),this.options=t,this.#c=e,this.#p=null,this.#A=W(),this.bindMethods(),this.setOptions(t)}#c;#g=void 0;#v=void 0;#C=void 0;#B;#y;#A;#p;#b;#x;#E;#M;#S;#F;#T=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),eo(this.#g,this.options)?this.#R():this.updateResult(),this.#w())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return es(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return es(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 w(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&&el(this.#g,r,this.options,t)&&this.#R(),this.updateResult(),n&&(this.#g!==r||w(this.options.enabled,this.#g)!==w(t.enabled,this.#g)||R(this.options.staleTime,this.#g)!==R(t.staleTime,this.#g))&&this.#L();let i=this.#O();n&&(this.#g!==r||w(this.options.enabled,this.#g)!==w(t.enabled,this.#g)||i!==this.#F)&&this.#P(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(S)),t}#L(){this.#D();let e=R(this.options.staleTime,this.#g);if(M||this.#C.isStale||!F(e))return;let t=T(this.#C.dataUpdatedAt,e);this.#M=E.setTimeout(()=>{this.#C.isStale||this.updateResult()},t+1)}#O(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#P(e){this.#I(),this.#F=e,!M&&!1!==w(this.options.enabled,this.#g)&&F(this.#F)&&0!==this.#F&&(this.#S=E.setInterval(()=>{(this.options.refetchIntervalInBackground||V.isFocused())&&this.#R()},this.#F))}#w(){this.#L(),this.#P(this.#O())}#D(){this.#M&&(E.clearTimeout(this.#M),this.#M=void 0)}#I(){this.#S&&(E.clearInterval(this.#S),this.#S=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&&eo(e,t),o=r&&el(e,n,t,i);(a||o)&&(c={...c,...er(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=j(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=j(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:eu(e,t),refetch:this.refetch,promise:this.#A,isEnabled:!1!==w(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=W())},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.#H({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()}#H(e){q.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#C)}),this.#c.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function eo(e,t){return!1!==w(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&es(e,t,t.refetchOnMount)}function es(e,t,r){if(!1!==w(t.enabled,e)&&"static"!==R(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&eu(e,t)}return!1}function el(e,t,r,n){return(e!==t||!1===w(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&eu(e,r)}function eu(e,t){return!1!==w(t.enabled,e)&&e.isStaleByTime(R(t.staleTime,e))}var ec=f.createContext(void 0),ed=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,d.jsx)(ec.Provider,{value:e,children:t})),ef=f.createContext((l=!1,{clearReset:()=>{l=!1},reset:()=>{l=!0},isReset:()=>l})),eh=f.createContext(!1);eh.Provider;var em=(e,t)=>void 0===t.state.data,ep=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function eA(e,t,r){let n=f.useContext(eh),i=f.useContext(ef),a=(e=>{let t=f.useContext(ec);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),f.useEffect(()=>{i.clearReset()},[i]);let s=!a.getQueryCache().get(o.queryHash),[l]=f.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),c=!n&&!1!==e.subscribed;if(f.useSyncExternalStore(f.useCallback(e=>{let t=c?l.subscribe(q.batchCalls(e)):S;return l.updateResult(),t},[l,c]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),f.useEffect(()=>{l.setOptions(o)},[o,l]),o?.suspense&&u.isPending)throw ep(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&&!M&&u.isLoading&&u.isFetching&&!n){let e=s?ep(o,l,i):a.getQueryCache().get(o.queryHash)?.promise;e?.catch(S).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?u:l.trackResult(u)}var eg=e.i(54970),ev=e.i(12979),eC=e.i(49774),eB=e.i(73949),ey=e.i(62395),eb=e.i(75567),ex=e.i(47071);let eE={value:!0},eM=`
|
||
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 eS=e.i(79123),eF=e.i(47021),eT=e.i(48066);let eR={0:32,1:32,2:32,3:32,4:32,5:32};function ew({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:i,lightmap:a}){let{debugMode:o}=(0,eS.useDebug)(),s=(0,ex.useTexture)(r.map(e=>(0,ev.terrainTextureToUrl)(e)),e=>{e.forEach(e=>(0,eb.setupTexture)(e))}),l=i?(0,ev.textureToUrl)(i):null,u=(0,ex.useTexture)(l??ev.FALLBACK_TEXTURE_URL,e=>{(0,eb.setupTexture)(e)}),c=(0,f.useCallback)(e=>{!function({shader:e,baseTextures:t,alphaTextures:r,visibilityMask:n,tiling:i,detailTexture:a=null,lightmap:o=null}){e.uniforms.sunLightPointsDown=eE;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;`:""}
|
||
|
||
${eM}
|
||
|
||
// 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:eR,detailTexture:l?u:null,lightmap:a}),(0,eF.injectCustomFog)(e,eT.globalFogUniforms)},[s,n,t,u,l,a]),h=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=h.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:h,map:e,depthWrite:!0,side:p.FrontSide,defines:{DEBUG_MODE:+!!o},onBeforeCompile:c},m)}function eD({displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:i,lightmap:a}){return(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)("meshLambertMaterial",{color:"rgb(0, 109, 56)",wireframe:!0}),children:(0,d.jsx)(ew,{displacementMap:e,visibilityMask:t,textureNames:r,alphaTextures:n,detailTextureName:i,lightmap:a})})}let eI=(0,f.memo)(function({tileX:e,tileZ:t,blockSize:r,basePosition:n,textureNames:i,geometry:a,displacementMap:o,visibilityMask:s,alphaTextures:l,detailTextureName:u,lightmap:c,visible:h=!0}){let m=(0,f.useMemo)(()=>{let i=r/2;return[n.x+e*r+i,0,n.z+t*r+i]},[e,t,r,n]);return(0,d.jsx)("mesh",{position:m,geometry:a,castShadow:!0,receiveShadow:!0,visible:h,children:(0,d.jsx)(eD,{displacementMap:o,visibilityMask:s,textureNames:i,alphaTextures:l,detailTextureName:u,lightmap:c})})});var eG=e.i(77482);function eL(e){return(0,eG.useRuntime)().getObjectByName(e)}function eO(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 p.DataTexture(t,256,256,p.RedFormat,p.UnsignedByteType);return r.colorSpace=p.NoColorSpace,r.wrapS=r.wrapT=p.ClampToEdgeWrapping,r.magFilter=p.NearestFilter,r.minFilter=p.NearestFilter,r.needsUpdate=!0,r}let eP=(0,f.memo)(function({object:e}){let t=(0,ey.getProperty)(e,"terrainFile"),r=(0,ey.getInt)(e,"squareSize")??8,n=(0,ey.getProperty)(e,"detailTexture"),i=256*r,a=function(){let e=eL("Sky");if(!e)return 600;let t=(0,ey.getFloat)(e,"high_visibleDistance");return null!=t&&t>0?t:(0,ey.getFloat)(e,"visibleDistance")??600}(),o=(0,eB.useThree)(e=>e.camera),s=(0,f.useMemo)(()=>{let e=-(128*r);return{x:e,z:e}},[r]),l=(0,f.useMemo)(()=>{let t=(0,ey.getProperty)(e,"emptySquares");return t?t.split(" ").map(e=>parseInt(e,10)):[]},[e]),{data:u}=eA({queryKey:["terrain",t],queryFn:()=>(0,ev.loadTerrain)(t)},ea,void 0),c=(0,f.useMemo)(()=>{if(!u)return null;let e=function(e,t){let r=new p.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 p.BufferAttribute(o,1)),r.setAttribute("position",new p.Float32BufferAttribute(n,3)),r.setAttribute("normal",new p.Float32BufferAttribute(i,3)),r.setAttribute("uv",new p.Float32BufferAttribute(a,2)),r.rotateX(-Math.PI/2),r.rotateY(-Math.PI/2),r}(256*r,0);return!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,u.heightMap,r),e},[r,u]),h=eL("Sun"),m=(0,f.useMemo)(()=>{if(!h)return new p.Vector3(.57735,-.57735,.57735);let[e,t,r]=((0,ey.getProperty)(h,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(e=>parseFloat(e)),n=Math.sqrt(e*e+r*r+t*t);return new p.Vector3(e/n,r/n,t/n)},[h]),A=(0,f.useMemo)(()=>u?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 p.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 p.DataTexture(a,512,512,p.RedFormat,p.UnsignedByteType);return o.colorSpace=p.NoColorSpace,o.generateMipmaps=!0,o.wrapS=p.ClampToEdgeWrapping,o.wrapT=p.ClampToEdgeWrapping,o.magFilter=p.LinearFilter,o.minFilter=p.LinearFilter,o.needsUpdate=!0,o}(u.heightMap,m,r):null,[u,m,r]),g=(0,f.useMemo)(()=>{if(!u)return null;let e=function(e){let t=new Float32Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/65535;return t}(u.heightMap),t=new p.DataTexture(e,256,256,p.RedFormat,p.FloatType);return t.colorSpace=p.NoColorSpace,t.generateMipmaps=!1,t.wrapS=p.RepeatWrapping,t.wrapT=p.RepeatWrapping,t.needsUpdate=!0,t},[u]),v=(0,f.useMemo)(()=>eO(l),[l]),C=(0,f.useMemo)(()=>eO([]),[]),B=(0,f.useMemo)(()=>u?u.alphaMaps.map(e=>(0,eb.setupMask)(e)):null,[u]),y=(0,f.useMemo)(()=>{let e=2*Math.ceil(a/i)+1;return e*e-1},[a,i]),b=(0,f.useMemo)(()=>Array.from({length:y},(e,t)=>t),[y]),[x,E]=(0,f.useState)(()=>Array(y).fill(null)),M=(0,f.useRef)({xStart:0,xEnd:0,zStart:0,zEnd:0});return((0,eC.useFrame)(()=>{let e=o.position.x-s.x,t=o.position.z-s.z,r=Math.floor((e-a)/i),n=Math.ceil((e+a)/i),l=Math.floor((t-a)/i),u=Math.ceil((t+a)/i),c=M.current;if(r===c.xStart&&n===c.xEnd&&l===c.zStart&&u===c.zEnd)return;c.xStart=r,c.xEnd=n,c.zStart=l,c.zEnd=u;let d=[];for(let e=r;e<n;e++)for(let t=l;t<u;t++)(0!==e||0!==t)&&d.push({tileX:e,tileZ:t});for(;d.length<y;)d.push(null);E(d)}),u&&c&&g&&B)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eI,{tileX:0,tileZ:0,blockSize:i,basePosition:s,textureNames:u.textureNames,geometry:c,displacementMap:g,visibilityMask:v,alphaTextures:B,detailTextureName:n,lightmap:A}),b.map(e=>{let t=x[e];return(0,d.jsx)(eI,{tileX:t?.tileX??0,tileZ:t?.tileZ??0,blockSize:i,basePosition:s,textureNames:u.textureNames,geometry:c,displacementMap:g,visibilityMask:C,alphaTextures:B,detailTextureName:n,lightmap:A,visible:null!==t},e)})]}):null}),eH=(0,f.createContext)(null);function e_(){return(0,f.useContext)(eH)}var ek=f;let eU=(0,ek.createContext)(null),ej={didCatch:!1,error:null};class eN extends ek.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=ej}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];null==(t=(r=this.props).onReset)||t.call(r,{args:i,reason:"imperative-api"}),this.setState(ej)}}componentDidCatch(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var i,a;null==(i=(a=this.props).onReset)||i.call(a,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(ej)}}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,ek.createElement)(r,e);else if(void 0!==n)o=n;else throw a}return(0,ek.createElement)(eU.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}}var eJ=e.i(31067),eK=p;function eQ(e,t){if(t===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==p.TriangleFanDrawMode&&t!==p.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===p.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 eV=parseInt(p.REVISION.replace(/\D+/g,""));function eq(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 eX="srgb",eW="srgb-linear";class eY extends eK.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new e9(e)}),this.register(function(e){return new e2(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 e8(e)}),this.register(function(e){return new e5(e)}),this.register(function(e){return new e6(e)}),this.register(function(e){return new e4(e)}),this.register(function(e){return new e1(e)}),this.register(function(e){return new e7(e)}),this.register(function(e){return new e3(e)}),this.register(function(e){return new tt(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new e$(e)}),this.register(function(e){return new ta(e)}),this.register(function(e){return new to(e)})}load(e,t,r,n){let i,a=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){let t=eK.LoaderUtils.extractUrlBase(e);i=eK.LoaderUtils.resolveURL(t,this.path)}else i=eK.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 eK.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(eq(new Uint8Array(e.slice(0,4)))===ts){try{a[eZ.KHR_BINARY_GLTF]=new tl(e)}catch(e){n&&n(e);return}i=JSON.parse(a[eZ.KHR_BINARY_GLTF].content)}else i=JSON.parse(eq(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 tT(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 eZ.KHR_MATERIALS_UNLIT:a[t]=new e0;break;case eZ.KHR_DRACO_MESH_COMPRESSION:a[t]=new tu(i,this.dracoLoader);break;case eZ.KHR_TEXTURE_TRANSFORM:a[t]=new tc;break;case eZ.KHR_MESH_QUANTIZATION:a[t]=new td;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 ez(){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 eZ={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 e${constructor(e){this.parser=e,this.name=eZ.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 eK.Color(0xffffff);void 0!==o.color&&s.setRGB(o.color[0],o.color[1],o.color[2],eW);let l=void 0!==o.range?o.range:0;switch(o.type){case"directional":(t=new eK.DirectionalLight(s)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new eK.PointLight(s)).distance=l;break;case"spot":(t=new eK.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,tE(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 e0{constructor(){this.name=eZ.KHR_MATERIALS_UNLIT}getMaterialType(){return eK.MeshBasicMaterial}extendParams(e,t,r){let n=[];e.color=new eK.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],eW),e.opacity=t[3]}void 0!==i.baseColorTexture&&n.push(r.assignTexture(e,"map",i.baseColorTexture,eX))}return Promise.all(n)}}class e1{constructor(e){this.parser=e,this.name=eZ.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 e9{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 eK.Vector2(e,e)}return Promise.all(i)}}class e2{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 e3{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 e8{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 eK.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],eW)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&i.push(r.assignTexture(t,"sheenColorMap",a.sheenColorTexture,eX)),void 0!==a.sheenRoughnessTexture&&i.push(r.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(i)}}class e5{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 e6{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 eK.Color().setRGB(o[0],o[1],o[2],eW),Promise.all(i)}}class e4{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 e7{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 eK.Color().setRGB(o[0],o[1],o[2],eW),void 0!==a.specularColorTexture&&i.push(r.assignTexture(t,"specularColorMap",a.specularColorTexture,eX)),Promise.all(i)}}class te{constructor(e){this.parser=e,this.name=eZ.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 tt{constructor(e){this.parser=e,this.name=eZ.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?eK.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 tr{constructor(e){this.parser=e,this.name=eZ.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 tn{constructor(e){this.parser=e,this.name=eZ.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 ti{constructor(e){this.parser=e,this.name=eZ.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 ta{constructor(e){this.name=eZ.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 to{constructor(e){this.name=eZ.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!==tp.TRIANGLES&&e.mode!==tp.TRIANGLE_STRIP&&e.mode!==tp.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 eK.Matrix4,r=new eK.Vector3,o=new eK.Quaternion,s=new eK.Vector3(1,1,1),l=new eK.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 eK.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);eK.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 ts="glTF";class tl{constructor(e){this.name=eZ.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:eq(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==ts)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=eq(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 tu{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=eZ.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[tB[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let n=tB[t]||t.toLowerCase();if(void 0!==a[t]){let i=r.accessors[e.attributes[t]],a=tA[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,eW,r)})})}}class tc{constructor(){this.name=eZ.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 td{constructor(){this.name=eZ.KHR_MESH_QUANTIZATION}}class tf extends eK.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 th=new eK.Quaternion;class tm extends tf{interpolate_(e,t,r,n){let i=super.interpolate_(e,t,r,n);return th.fromArray(i).normalize().toArray(i),i}}let tp={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},tA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tg={9728:eK.NearestFilter,9729:eK.LinearFilter,9984:eK.NearestMipmapNearestFilter,9985:eK.LinearMipmapNearestFilter,9986:eK.NearestMipmapLinearFilter,9987:eK.LinearMipmapLinearFilter},tv={33071:eK.ClampToEdgeWrapping,33648:eK.MirroredRepeatWrapping,10497:eK.RepeatWrapping},tC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tB={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...eV>=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"},ty={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tb={CUBICSPLINE:void 0,LINEAR:eK.InterpolateLinear,STEP:eK.InterpolateDiscrete};function tx(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 tE(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 tM(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 tS(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 tF=new eK.Matrix4;class tT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ez,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 eK.TextureLoader(this.options.manager):this.textureLoader=new eK.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new eK.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 tx(i,a,n),tE(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[eZ.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(e,i){r.load(eK.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=tC[n.type],t=tA[n.componentType],r=!0===n.normalized,i=new t(n.count*e);return Promise.resolve(new eK.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=tC[n.type],l=tA[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 eK.InterleavedBuffer(i,f/u),t.cache.add(r,c)),a=new eK.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 eK.BufferAttribute(i,s,h);if(void 0!==n.sparse){let t=tC.SCALAR,r=tA[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 eK.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=tg[r.magFilter]||eK.LinearFilter,t.minFilter=tg[r.minFilter]||eK.LinearMipmapLinearFilter,t.wrapS=tv[r.wrapS]||eK.RepeatWrapping,t.wrapT=tv[r.wrapT]||eK.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 eK.Texture(e);t.needsUpdate=!0,r(t)}),t.load(eK.LoaderUtils.resolveURL(e,n.path),a,void 0,i)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),tE(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[eZ.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[eZ.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[eZ.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return void 0!==n&&("number"==typeof n&&(n=3001===n?eX:eW),"colorSpace"in a?a.colorSpace=n:a.encoding=n===eX?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 eK.PointsMaterial,eK.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 eK.LineBasicMaterial,eK.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 eK.MeshStandardMaterial}loadMaterial(e){let t,r=this,n=this.json,i=this.extensions,a=n.materials[e],o={},s=a.extensions||{},l=[];if(s[eZ.KHR_MATERIALS_UNLIT]){let e=i[eZ.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(o,a,r))}else{let n=a.pbrMetallicRoughness||{};if(o.color=new eK.Color(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],eW),o.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(r.assignTexture(o,"map",n.baseColorTexture,eX)),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=eK.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!==eK.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new eK.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==eK.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==eK.MeshBasicMaterial){let e=a.emissiveFactor;o.emissive=new eK.Color().setRGB(e[0],e[1],e[2],eW)}return void 0!==a.emissiveTexture&&t!==eK.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",a.emissiveTexture,eX)),Promise.all(l).then(function(){let n=new t(o);return a.name&&(n.name=a.name),tE(n,a),r.associations.set(n,{materials:e}),a.extensions&&tx(i,n,a),n})}createUniqueName(e){let t=eK.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[eZ.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+tM(r.attributes):e.indices+":"+tM(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,n=e.targets.length;r<n;r++)t+=":"+tM(e.targets[r]);return t}(o),l=n[s];if(l)i.push(l.promise);else{let e;e=o.extensions&&o.extensions[eZ.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[eZ.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return tR(r,e,t)})}(o):tR(new eK.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 eK.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:eK.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===tp.TRIANGLES||d.mode===tp.TRIANGLE_STRIP||d.mode===tp.TRIANGLE_FAN||void 0===d.mode)!0===(u=!0===i.isSkinnedMesh?new eK.SkinnedMesh(c,f):new eK.Mesh(c,f)).isSkinnedMesh&&u.normalizeSkinWeights(),d.mode===tp.TRIANGLE_STRIP?u.geometry=eQ(u.geometry,eK.TriangleStripDrawMode):d.mode===tp.TRIANGLE_FAN&&(u.geometry=eQ(u.geometry,eK.TriangleFanDrawMode));else if(d.mode===tp.LINES)u=new eK.LineSegments(c,f);else if(d.mode===tp.LINE_STRIP)u=new eK.Line(c,f);else if(d.mode===tp.LINE_LOOP)u=new eK.LineLoop(c,f);else if(d.mode===tp.POINTS)u=new eK.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),tE(u,i),d.extensions&&tx(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&&tx(n,l[0],i),l[0];let u=new eK.Group;i.extensions&&tx(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 eK.PerspectiveCamera(eK.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(t=new eK.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),tE(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 eK.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 eK.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 eK.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,tF)});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 eK.Bone:t.length>1?new eK.Group:1===t.length?t[0]:new eK.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),tE(o,i),i.extensions&&tx(r,o,i),void 0!==i.matrix){let e=new eK.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 eK.Group;r.name&&(i.name=n.createUniqueName(r.name)),tE(i,r),r.extensions&&tx(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 eK.Material||e instanceof eK.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(ty[i.path]===ty.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(s),ty[i.path]){case ty.weights:a=eK.NumberKeyframeTrack;break;case ty.rotation:a=eK.QuaternionKeyframeTrack;break;case ty.position:case ty.scale:a=eK.VectorKeyframeTrack;break;default:a=1===r.itemSize?eK.NumberKeyframeTrack:eK.VectorKeyframeTrack}let u=void 0!==n.interpolation?tb[n.interpolation]:eK.InterpolateLinear,c=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e<r;e++){let r=new a(l[e]+"."+ty[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=tS(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 eK.QuaternionKeyframeTrack?tm:tf)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function tR(e,t,r){let n=t.attributes,i=[];for(let t in n){let a=tB[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 tE(e,t),!function(e,t,r){let n=t.attributes,i=new eK.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 eK.Vector3(t[0],t[1],t[2]),new eK.Vector3(a[0],a[1],a[2])),e.normalized){let t=tS(tA[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new eK.Vector3,t=new eK.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=tS(tA[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 eK.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 tw=p;let tD=new WeakMap;class tI extends tw.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 tw.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(tD.has(e)){let t=tD.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)}),tD.set(e,{key:n,promise:o}),o}_createGeometry(e){let t=new tw.BufferGeometry;e.index&&t.setIndex(new tw.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 tw.BufferAttribute(a,o))}return t}_loadLibrary(e,t){let r=new tw.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=tG.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 tG(){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 tL=e.i(971);let tO=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},tP=f.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=f.useMemo(()=>{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return tO(t)}return t},[t,e])))return f.createElement("group",(0,eJ.default)({},l,{ref:u}),t.map(e=>f.createElement(tP,(0,eJ.default)({key:e.uuid,object:e},c))),r);let{children:d,...h}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:n,castShadow:i,receiveShadow:a}){let 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)}:f.isValidElement(n)?{...o,children:n}:{...o,...n}),e instanceof p.Mesh&&(i&&(o.castShadow=!0),a&&(o.receiveShadow=!0)),o}(t,c),m=t.type[0].toLowerCase()+t.type.slice(1);return f.createElement(m,(0,eJ.default)({},h,l,{ref:u}),t.children.map(e=>"Bone"===e.type?f.createElement("primitive",(0,eJ.default)({key:e.uuid,object:e},c)):f.createElement(tP,(0,eJ.default)({key:e.uuid,object:e},c,{isChild:!0}))),r,d)}),tH=null,t_="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function tk(e=!0,r=!0,n){return i=>{n&&n(i),e&&(tH||(tH=new tI),tH.setDecoderPath("string"==typeof e?e:t_),i.setDRACOLoader(tH)),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="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;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 tU=(e,t,r,n)=>(0,tL.useLoader)(eY,e,tk(t,r,n));tU.preload=(e,t,r,n)=>tL.useLoader.preload(eY,e,tk(t,r,n)),tU.clear=e=>tL.useLoader.clear(eY,e),tU.setDecoderPath=e=>{t_=e};var tj=e.i(89887);let tN=`
|
||
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 tJ({materialName:e,material:t,lightMap:r}){let n=(0,eS.useDebug)(),i=n?.debugMode??!1,a=(0,ev.textureToUrl)(e),o=(0,ex.useTexture)(a,e=>(0,eb.setupTexture)(e)),s=new Set(t?.userData?.flag_names??[]).has("SelfIlluminating"),l=new Set(t?.userData?.surface_flag_names??[]).has("SurfaceOutsideVisible"),u=(0,f.useCallback)(e=>{let t;(0,eF.injectCustomFog)(e,eT.globalFogUniforms),t=l??!1,e.uniforms.useSceneLighting={value:t},e.uniforms.interiorDebugColor={value:t?new p.Vector3(0,.4,1):new p.Vector3(1,.2,0)},e.fragmentShader=e.fragmentShader.replace("#include <common>",`#include <common>
|
||
${tN}
|
||
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,f.useRef)(null),h=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=c.current??h.current;e&&(e.defines??={},e.defines.DEBUG_MODE=+!!i,e.needsUpdate=!0)},[i]);let m={DEBUG_MODE:+!!i},A=`${l}`;return s?(0,d.jsx)("meshBasicMaterial",{ref:c,map:o,toneMapped:!1,defines:m,onBeforeCompile:u},A):(0,d.jsx)("meshLambertMaterial",{ref:h,map:o,lightMap:r,toneMapped:!1,defines:m,onBeforeCompile:u},A)}function tK(e){if(!e)return null;let t=e.emissiveMap;return t&&(t.colorSpace=p.SRGBColorSpace),t??null}function tQ({node:e}){let t=(0,f.useMemo)(()=>e.material?Array.isArray(e.material)?e.material.map(e=>tK(e)):[tK(e.material)]:[],[e.material]);return(0,d.jsx)("mesh",{geometry:e.geometry,castShadow:!0,receiveShadow:!0,children:e.material?(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)("meshStandardMaterial",{color:"yellow",wireframe:!0}),children:Array.isArray(e.material)?e.material.map((e,r)=>(0,d.jsx)(tJ,{materialName:e.userData.resource_path,material:e,lightMap:t[r]},r)):(0,d.jsx)(tJ,{materialName:e.material.userData.resource_path,material:e.material,lightMap:t[0]})}):null})}let tV=(0,f.memo)(({object:e,interiorFile:t})=>{let{nodes:r}=tU((0,ev.interiorToUrl)(t)),n=(0,eS.useDebug)(),i=n?.debugMode??!1;return(0,d.jsxs)("group",{rotation:[0,-Math.PI/2,0],children:[Object.entries(r).filter(([,e])=>e.isMesh).map(([e,t])=>(0,d.jsx)(tQ,{node:t},e)),i?(0,d.jsxs)(tj.FloatingLabel,{children:[e._id,": ",t]}):null]})});function tq({color:e,label:t}){return(0,d.jsxs)("mesh",{children:[(0,d.jsx)("boxGeometry",{args:[10,10,10]}),(0,d.jsx)("meshStandardMaterial",{color:e,wireframe:!0}),t?(0,d.jsx)(tj.FloatingLabel,{color:e,children:t}):null]})}function tX({label:e}){let t=(0,eS.useDebug)();return t?.debugMode?(0,d.jsx)(tq,{color:"red",label:e}):null}let tW=(0,f.memo)(function({object:e}){let t=(0,ey.getProperty)(e,"interiorFile"),r=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),n=(0,f.useMemo)(()=>(0,ey.getScale)(e),[e]),i=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]);return(0,d.jsx)("group",{position:r,quaternion:i,scale:n,children:(0,d.jsx)(eN,{fallback:(0,d.jsx)(tX,{label:`${e._id}: ${t}`}),children:(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)(tq,{color:"orange"}),children:(0,d.jsx)(tV,{object:e,interiorFile:t})})})})});function tY(e,{path:t}){let[r]=(0,tL.useLoader)(p.CubeTextureLoader,[e],e=>e.setPath(t));return r}tY.preload=(e,{path:t})=>tL.useLoader.preload(p.CubeTextureLoader,[e],e=>e.setPath(t));let tz=()=>{};function tZ(e){return e.wrapS=p.RepeatWrapping,e.wrapT=p.RepeatWrapping,e.minFilter=p.LinearFilter,e.magFilter=p.LinearFilter,e.colorSpace=p.NoColorSpace,e.needsUpdate=!0,e}let t$=`
|
||
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;
|
||
}
|
||
`,t0=`
|
||
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 t1({textureUrl:e,radius:t,heightPercent:r,speed:n,windDirection:i,layerIndex:a}){let{debugMode:o}=(0,eS.useDebug)(),{animationEnabled:s}=(0,eS.useSettings)(),l=(0,f.useRef)(null),u=(0,ex.useTexture)(e,tZ),c=(0,f.useMemo)(()=>{let e=r-.05;return function(e,t,r,n){var i;let a,o,s,l,u,c,d,f,h,m,A,g,v,C,B,y,b,x=new p.BufferGeometry,E=new Float32Array(75),M=new Float32Array(50),S=[.05,.05,.05,.05,.05,.05,r,r,r,.05,.05,r,t,r,.05,.05,r,r,r,.05,.05,.05,.05,.05,.05],F=2*e/4;for(let t=0;t<5;t++)for(let r=0;r<5;r++){let n=5*t+r,i=-e+r*F,a=e-t*F,o=e*S[n];E[3*n]=i,E[3*n+1]=o,E[3*n+2]=a,M[2*n]=r,M[2*n+1]=t}i=E,a=e=>({x:i[3*e],y:i[3*e+1],z:i[3*e+2]}),o=(e,t,r,n)=>{i[3*e]=t,i[3*e+1]=r,i[3*e+2]=n},s=a(1),l=a(3),u=a(5),c=a(6),d=a(8),f=a(9),h=a(15),m=a(16),A=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,A.x+(B-A.x)*2,A.y+(y-A.y)*2,A.z+(b-A.z)*2);let T=function(e,t){let r=new Float32Array(25);for(let n=0;n<25;n++){let i=e[3*n],a=e[3*n+2],o=1.3-Math.sqrt(i*i+a*a)/t;o<.4?o=0:o>.8&&(o=1),r[n]=o}return r}(E,e),R=[];for(let e=0;e<4;e++)for(let t=0;t<4;t++){let r=5*e+t,n=r+1,i=r+5,a=i+1;R.push(r,i,a),R.push(r,a,n)}return x.setIndex(R),x.setAttribute("position",new p.Float32BufferAttribute(E,3)),x.setAttribute("uv",new p.Float32BufferAttribute(M,2)),x.setAttribute("alpha",new p.Float32BufferAttribute(T,1)),x.computeBoundingSphere(),x}(t,r,e,0)},[t,r]);(0,f.useEffect)(()=>()=>{c.dispose()},[c]);let h=(0,f.useMemo)(()=>new p.ShaderMaterial({uniforms:{cloudTexture:{value:u},uvOffset:{value:new p.Vector2(0,0)},debugMode:{value:+!!o},layerIndex:{value:a}},vertexShader:t$,fragmentShader:t0,transparent:!0,depthWrite:!1,side:p.DoubleSide}),[u,o,a]);return(0,f.useEffect)(()=>()=>{h.dispose()},[h]),(0,eC.useFrame)(s?(e,t)=>{let r=1e3*t/32;l.current??=new p.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),h.uniforms.uvOffset.value.copy(l.current)}:tz),(0,d.jsx)("mesh",{geometry:c,frustumCulled:!1,renderOrder:10,children:(0,d.jsx)("primitive",{object:h,attach:"material"})})}function t9({object:e}){var t;let{data:r}=eA({queryKey:["detailMapList",t=(0,ey.getProperty)(e,"materialList")],queryFn:()=>(0,ev.loadDetailMapList)(t),enabled:!!t},ea,void 0),n=.95*((0,ey.getFloat)(e,"visibleDistance")??500),i=(0,f.useMemo)(()=>[(0,ey.getFloat)(e,"cloudSpeed1")??1e-4,(0,ey.getFloat)(e,"cloudSpeed2")??2e-4,(0,ey.getFloat)(e,"cloudSpeed3")??3e-4],[e]),a=(0,f.useMemo)(()=>[(0,ey.getFloat)(e,"cloudHeightPer1")??.35,(0,ey.getFloat)(e,"cloudHeightPer2")??.25,(0,ey.getFloat)(e,"cloudHeightPer3")??.2],[e]),o=(0,f.useMemo)(()=>{let t=(0,ey.getProperty)(e,"windVelocity");if(t){let[e,r]=t.split(" ").map(e=>parseFloat(e));if(0!==e||0!==r)return new p.Vector2(r,-e).normalize()}return new p.Vector2(1,0)},[e]),s=(0,f.useMemo)(()=>{if(!r)return[];let e=[];for(let t=0;t<3;t++){let n=r[7+t];n&&e.push({texture:n,height:a[t],speed:i[t]})}return e},[r,i,a]),l=(0,f.useRef)(null);return((0,eC.useFrame)(({camera:e})=>{l.current&&l.current.position.copy(e.position)}),s&&0!==s.length)?(0,d.jsx)("group",{ref:l,children:s.map((e,t)=>{let r=(0,ev.textureToUrl)(e.texture);return(0,d.jsx)(f.Suspense,{fallback:null,children:(0,d.jsx)(t1,{textureUrl:r,radius:n,heightPercent:e.height,speed:e.speed,windDirection:o,layerIndex:t})},t)})}):null}let t2=!1;function t3(e){if(!e)return;let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return[new p.Color().setRGB(t,r,n),new p.Color().setRGB(t,r,n).convertSRGBToLinear()]}function t8({skyBoxFiles:e,fogColor:t,fogState:r}){let{camera:n}=(0,eB.useThree)(),i=tY(e,{path:""}),a=!!t,o=(0,f.useMemo)(()=>n.projectionMatrixInverse,[n]),s=(0,f.useMemo)(()=>r?(0,eT.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),l=(0,f.useRef)({skybox:{value:i},fogColor:{value:t??new p.Color(0,0,0)},enableFog:{value:a},inverseProjectionMatrix:{value:o},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eT.globalFogUniforms.cameraHeight,fogVolumeData:{value:s},horizonFogHeight:{value:.18}}),u=(0,f.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]);return(0,f.useEffect)(()=>{l.current.skybox.value=i,l.current.fogColor.value=t??new p.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 t5({materialList:e,fogColor:t,fogState:r}){let{data:n}=eA({queryKey:["detailMapList",e],queryFn:()=>(0,ev.loadDetailMapList)(e)},ea,void 0),i=(0,f.useMemo)(()=>n?[(0,ev.textureToUrl)(n[1]),(0,ev.textureToUrl)(n[3]),(0,ev.textureToUrl)(n[4]),(0,ev.textureToUrl)(n[5]),(0,ev.textureToUrl)(n[0]),(0,ev.textureToUrl)(n[2])]:null,[n]);return i?(0,d.jsx)(t8,{skyBoxFiles:i,fogColor:t,fogState:r}):null}function t6({skyColor:e,fogColor:t,fogState:r}){let{camera:n}=(0,eB.useThree)(),i=!!t,a=(0,f.useMemo)(()=>n.projectionMatrixInverse,[n]),o=(0,f.useMemo)(()=>r?(0,eT.packFogVolumeData)(r.fogVolumes):new Float32Array(12),[r]),s=(0,f.useMemo)(()=>{if(!r)return .18;let e=.95*r.visibleDistance/Math.sqrt(3);return 60/Math.sqrt(e*e+3600)},[r]),l=(0,f.useRef)({skyColor:{value:e},fogColor:{value:t??new p.Color(0,0,0)},enableFog:{value:i},inverseProjectionMatrix:{value:a},cameraMatrixWorld:{value:n.matrixWorld},cameraHeight:eT.globalFogUniforms.cameraHeight,fogVolumeData:{value:o},horizonFogHeight:{value:s}});return(0,f.useEffect)(()=>{l.current.skyColor.value=e,l.current.fogColor.value=t??new p.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 t4(e,t){let{fogDistance:r,visibleDistance:n}=e;return[r,n]}function t7({fogState:e,enabled:t}){let{scene:r,camera:n}=(0,eB.useThree)(),i=(0,f.useRef)(null),a=(0,f.useMemo)(()=>(0,eT.packFogVolumeData)(e.fogVolumes),[e.fogVolumes]);return(0,f.useEffect)(()=>{t2||((0,eF.installCustomFogShader)(),t2=!0)},[]),(0,f.useEffect)(()=>{(0,eT.resetGlobalFogUniforms)();let[t,o]=t4(e,n.position.y),s=new p.Fog(e.fogColor,t,o);return r.fog=s,i.current=s,(0,eT.updateGlobalFogUniforms)(n.position.y,a),()=>{r.fog=null,i.current=null,(0,eT.resetGlobalFogUniforms)()}},[r,n,e,a]),(0,f.useEffect)(()=>{let r=i.current;if(r)if(t){let[t,i]=t4(e,n.position.y);r.near=t,r.far=i}else r.near=1e10,r.far=1e10},[t,e,n.position.y]),(0,eC.useFrame)(()=>{let r=i.current;if(!r)return;let o=n.position.y;if((0,eT.updateGlobalFogUniforms)(o,a,t),t){let[t,n]=t4(e,o);r.near=t,r.far=n,r.color.copy(e.fogColor)}}),null}let re=/borg|xorg|porg|dorg|plant|tree|bush|fern|vine|grass|leaf|flower|frond|palm|foliage/i;function rt(e){return re.test(e)}let rr=(0,f.createContext)(null);function rn(){let e=(0,f.useContext)(rr);if(!e)throw Error("useShapeInfo must be used within ShapeInfoProvider");return e}function ri({children:e,object:t,shapeName:r,type:n}){let i=(0,f.useMemo)(()=>rt(r),[r]),a=(0,f.useMemo)(()=>({object:t,shapeName:r,type:n,isOrganic:i}),[t,r,n,i]);return(0,d.jsx)(rr.Provider,{value:a,children:e})}var ra=e.i(51475);let ro=new Map;function rs(e){e.onBeforeCompile=t=>{(0,eF.injectCustomFog)(t,eT.globalFogUniforms),e instanceof p.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 rl(e,t,r,n){let i=r.has("Translucent"),a=r.has("Additive");if(r.has("SelfIlluminating")){let e=new p.MeshBasicMaterial({map:t,side:2,transparent:a,alphaTest:.5*!a,fog:!0,...a&&{blending:p.AdditiveBlending}});return rs(e),e}if(n||i){let e={map:t,transparent:!1,alphaTest:.5,reflectivity:0},r=new p.MeshLambertMaterial({...e,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),n=new p.MeshLambertMaterial({...e,side:0});return rs(r),rs(n),[r,n]}let o=new p.MeshLambertMaterial({map:t,side:2,reflectivity:0});return rs(o),o}let ru=(0,f.memo)(function({material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:i=!1,receiveShadow:a=!1}){let o=e.userData.resource_path,s=new Set(e.userData.flag_names??[]),l=function(e){let{animationEnabled:t}=(0,eS.useSettings)(),{data:r}=eA({queryKey:["ifl",e],queryFn:()=>(0,ev.loadImageFrameList)(e),enabled:!0,suspense:!0,throwOnError:em,placeholderData:void 0},ea,void 0),n=(0,f.useMemo)(()=>r.map(t=>(0,ev.iflTextureToUrl)(t.name,e)),[r,e]),i=(0,ex.useTexture)(n),a=(0,f.useMemo)(()=>{var t;let n,a=ro.get(e);if(!a){let t,r,n,o,s,l,u,c,d;r=(t=i[0].image).width,n=t.height,s=Math.ceil(Math.sqrt(o=i.length)),l=Math.ceil(o/s),(u=document.createElement("canvas")).width=r*s,u.height=n*l,c=u.getContext("2d"),i.forEach((e,t)=>{let i=Math.floor(t/s);c.drawImage(e.image,t%s*r,i*n)}),(d=new p.CanvasTexture(u)).colorSpace=p.SRGBColorSpace,d.generateMipmaps=!1,d.minFilter=p.NearestFilter,d.magFilter=p.NearestFilter,d.wrapS=p.ClampToEdgeWrapping,d.wrapT=p.ClampToEdgeWrapping,d.repeat.set(1/s,1/l),a={texture:d,columns:s,rows:l,frameCount:o,frameStartTicks:[],totalTicks:0,lastFrame:-1},ro.set(e,a)}return n=0,(t=a).frameStartTicks=r.map(e=>{let t=n;return n+=e.frameCount,t}),t.totalTicks=n,a},[e,i,r]);return(0,ra.useTick)(e=>{let r=t?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}(a,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)}(a,r)}),a.texture}(`textures/${o}.ifl`),u=t&&rt(t),c=(0,f.useMemo)(()=>rl(e,l,s,u),[e,l,s,u]);return Array.isArray(c)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("mesh",{geometry:n||r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:c[0],attach:"material"})}),(0,d.jsx)("mesh",{geometry:r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:c[1],attach:"material"})})]}):(0,d.jsx)("mesh",{geometry:r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:c,attach:"material"})})}),rc=(0,f.memo)(function({material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:i=!1,receiveShadow:a=!1}){let o=e.userData.resource_path,s=new Set(e.userData.flag_names??[]),l=(0,f.useMemo)(()=>(o||console.warn(`No resource_path was found on "${t}" - rendering fallback.`),o?(0,ev.textureToUrl)(o):ev.FALLBACK_TEXTURE_URL),[o,t]),u=t&&rt(t),c=s.has("Translucent"),h=(0,ex.useTexture)(l,e=>u||c?(0,eb.setupTexture)(e,{disableMipmaps:!0}):(0,eb.setupTexture)(e)),m=(0,f.useMemo)(()=>rl(e,h,s,u),[e,h,s,u]);return Array.isArray(m)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("mesh",{geometry:n||r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:m[0],attach:"material"})}),(0,d.jsx)("mesh",{geometry:r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:m[1],attach:"material"})})]}):(0,d.jsx)("mesh",{geometry:r,castShadow:i,receiveShadow:a,children:(0,d.jsx)("primitive",{object:m,attach:"material"})})}),rd=(0,f.memo)(function({material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:i=!1,receiveShadow:a=!1}){let o=new Set(e.userData.flag_names??[]).has("IflMaterial"),s=e.userData.resource_path;return o&&s?(0,d.jsx)(ru,{material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:i,receiveShadow:a}):e.name?(0,d.jsx)(rc,{material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:i,receiveShadow:a}):null});function rf({color:e,label:t}){return(0,d.jsxs)("mesh",{children:[(0,d.jsx)("boxGeometry",{args:[10,10,10]}),(0,d.jsx)("meshStandardMaterial",{color:e,wireframe:!0}),t?(0,d.jsx)(tj.FloatingLabel,{color:e,children:t}):null]})}function rh({color:e,label:t}){let{debugMode:r}=(0,eS.useDebug)();return r?(0,d.jsx)(rf,{color:e,label:t}):null}function rm({loadingColor:e="yellow",children:t}){let{object:r,shapeName:n}=rn();return n?(0,d.jsx)(eN,{fallback:(0,d.jsx)(rh,{color:"red",label:`${r._id}: ${n}`}),children:(0,d.jsxs)(f.Suspense,{fallback:(0,d.jsx)(rf,{color:e}),children:[(0,d.jsx)(rp,{}),t]})}):(0,d.jsx)(rh,{color:"orange",label:`${r._id}: <missing>`})}let rp=(0,f.memo)(function(){let{object:e,shapeName:t,isOrganic:r}=rn(),{debugMode:n}=(0,eS.useDebug)(),{nodes:i}=tU((0,ev.shapeToUrl)(t)),a=(0,f.useMemo)(()=>{let e=Object.values(i).filter(e=>e.skeleton);if(e.length>0){var t;let r;return t=e[0].skeleton,r=new Set,t.bones.forEach((e,t)=>{e.name.match(/^Hulk/i)&&r.add(t)}),r}return new Set},[i]),o=(0,f.useMemo)(()=>Object.entries(i).filter(([e,t])=>t.material&&"Unassigned"!==t.material.name&&!t.name.match(/^Hulk/i)).map(([e,t])=>{let n=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,a),i=null;if(n){(n=n.clone()).computeVertexNormals();let e=n.attributes.position,t=n.attributes.normal,a=e.array,o=t.array,s=new Map;for(let t=0;t<e.count;t++){let e=`${a[3*t].toFixed(4)},${a[3*t+1].toFixed(4)},${a[3*t+2].toFixed(4)}`;s.has(e)||s.set(e,[]),s.get(e).push(t)}for(let e of s.values())if(e.length>1){let t=0,r=0,n=0;for(let i of e)t+=o[3*i],r+=o[3*i+1],n+=o[3*i+2];let i=Math.sqrt(t*t+r*r+n*n);for(let a of(i>0&&(t/=i,r/=i,n/=i),e))o[3*a]=t,o[3*a+1]=r,o[3*a+2]=n}if(t.needsUpdate=!0,r){let e=(i=n.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:n,backGeometry:i}}),[i,a,r]),s=!r;return(0,d.jsxs)("group",{rotation:[0,Math.PI/2,0],children:[o.map(({node:e,geometry:r,backGeometry:n})=>(0,d.jsx)(f.Suspense,{fallback:(0,d.jsx)("mesh",{geometry:r,children:(0,d.jsx)("meshStandardMaterial",{color:"gray",wireframe:!0})}),children:e.material?Array.isArray(e.material)?e.material.map((e,i)=>(0,d.jsx)(rd,{material:e,shapeName:t,geometry:r,backGeometry:n,castShadow:s,receiveShadow:s},i)):(0,d.jsx)(rd,{material:e.material,shapeName:t,geometry:r,backGeometry:n,castShadow:s,receiveShadow:s}):null},e.id)),n?(0,d.jsxs)(tj.FloatingLabel,{children:[e._id,": ",t]}):null]})});var rA=e.i(6112);let rg={1:"Storm",2:"Inferno"},rv=(0,f.createContext)(null);function rC(){let e=(0,f.useContext)(rv);if(!e)throw Error("useCameras must be used within CamerasProvider");return e}function rB({children:e}){let{camera:t}=(0,eB.useThree)(),[r,n]=(0,f.useState)(-1),[i,a]=(0,f.useState)({}),[o,s]=(0,f.useState)(()=>({initialized:!1,position:null,quarternion:null})),l=(0,f.useCallback)(e=>{a(t=>({...t,[e.id]:e}))},[]),u=(0,f.useCallback)(e=>{a(t=>{let{[e.id]:r,...n}=t;return n})},[]),c=Object.keys(i).length,h=(0,f.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 p.Quaternion().setFromAxisAngle(new p.Vector3(0,1,0),-Math.PI/2);t.quaternion.copy(a.rotation).multiply(o)}},[t,c,i]),m=(0,f.useCallback)(()=>{h(c?(r+1)%c:-1)},[c,r,h]);(0,f.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 p.Vector3(...n),quarternion:new p.Quaternion(...i)})}else s({initialized:!0,position:null,quarternion:null})};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,f.useEffect)(()=>{o.initialized&&o.position&&(t.position.copy(o.position),o.quarternion&&t.quaternion.copy(o.quarternion))},[o]),(0,f.useEffect)(()=>{o.initialized&&!o.position&&c>0&&-1===r&&h(0)},[c,h,r]);let A=(0,f.useMemo)(()=>({registerCamera:l,unregisterCamera:u,nextCamera:m,setCameraIndex:h,cameraCount:c}),[l,u,m,h,c]);return 0===c&&n(-1),(0,d.jsx)(rv.Provider,{value:A,children:e})}let ry=(0,f.createContext)(null),rb=ry.Provider,rx=(0,f.lazy)(()=>e.A(61921).then(e=>({default:e.AudioEmitter}))),rE={AudioEmitter:function(e){let{audioEnabled:t}=(0,eS.useSettings)();return t?(0,d.jsx)(rx,{...e}):null},Camera:function({object:e}){let{registerCamera:t,unregisterCamera:r}=rC(),n=(0,f.useId)(),i=(0,ey.getProperty)(e,"dataBlock"),a=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),o=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]);return(0,f.useEffect)(()=>{if("Observer"===i){let e={id:n,position:new p.Vector3(...a),rotation:o};return t(e),()=>{r(e)}}},[n,i,t,r,a,o]),null},ForceFieldBare:(0,f.lazy)(()=>e.A(25147).then(e=>({default:e.ForceFieldBare}))),InteriorInstance:tW,Item:function({object:e}){let t=e_(),r=(0,ey.getProperty)(e,"dataBlock")??"",n=(0,rA.useDatablock)(r),i=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),a=(0,f.useMemo)(()=>(0,ey.getScale)(e),[e]),o=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]),s=(0,ey.getProperty)(n,"shapeFile");s||console.error(`<Item> missing shape for datablock: ${r}`);let l=r?.toLowerCase()==="flag",u=t?.team??null,c=u&&u>0?rg[u]:null,h=l&&c?`${c} Flag`:null;return(0,d.jsx)(ri,{type:"Item",object:e,shapeName:s,children:(0,d.jsx)("group",{position:i,quaternion:o,scale:a,children:(0,d.jsx)(rm,{loadingColor:"pink",children:h?(0,d.jsx)(tj.FloatingLabel,{opacity:.6,children:h}):null})})})},SimGroup:function({object:e}){let t=e_(),r=(0,f.useMemo)(()=>{let r=null,n=!1;if(t&&t.hasTeams){if(n=!0,null!=t.team)r=t.team;else if(e._name){let t=e._name.match(/^team(\d+)$/i);t&&(r=parseInt(t[1],10))}}else e._name&&(n="teams"===e._name.toLowerCase());return{object:e,parent:t,hasTeams:n,team:r}},[e,t]);return(0,d.jsx)(eH.Provider,{value:r,children:(e._children??[]).map((e,t)=>(0,d.jsx)(rM,{object:e},e._id))})},Sky:function({object:e}){let{fogEnabled:t,highQualityFog:r}=(0,eS.useSettings)(),n=(0,ey.getProperty)(e,"materialList"),i=(0,f.useMemo)(()=>t3((0,ey.getProperty)(e,"SkySolidColor")),[e]),a=(0,ey.getInt)(e,"useSkyTextures")??1,o=(0,f.useMemo)(()=>(function(e,t=!0){let r=(0,ey.getFloat)(e,"fogDistance")??0,n=(0,ey.getFloat)(e,"visibleDistance")??1e3,i=(0,ey.getFloat)(e,"high_fogDistance"),a=(0,ey.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 p.Color(.5,.5,.5);let[t,r,n]=e.split(" ").map(e=>parseFloat(e));return new p.Color().setRGB(t,r,n).convertSRGBToLinear()}((0,ey.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,ey.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,f.useMemo)(()=>t3((0,ey.getProperty)(e,"fogColor")),[e]),l=i||s,u=o.enabled&&t,c=o.fogColor,{scene:h,gl:m}=(0,eB.useThree)();(0,f.useEffect)(()=>{if(u){let e=c.clone();h.background=e,m.setClearColor(e)}else if(l){let e=l[0].clone();h.background=e,m.setClearColor(e)}else h.background=null;return()=>{h.background=null}},[h,m,u,c,l]);let A=i?.[1];return(0,d.jsxs)(d.Fragment,{children:[n&&a?(0,d.jsx)(f.Suspense,{fallback:null,children:(0,d.jsx)(t5,{materialList:n,fogColor:u?c:void 0,fogState:u?o:void 0},n)}):A?(0,d.jsx)(t6,{skyColor:A,fogColor:u?c:void 0,fogState:u?o:void 0}):null,(0,d.jsx)(f.Suspense,{children:(0,d.jsx)(t9,{object:e})}),o.enabled?(0,d.jsx)(t7,{fogState:o,enabled:t}):null]})},StaticShape:function({object:e}){let t=(0,ey.getProperty)(e,"dataBlock")??"",r=(0,rA.useDatablock)(t),n=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),i=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]),a=(0,f.useMemo)(()=>(0,ey.getScale)(e),[e]),o=(0,ey.getProperty)(r,"shapeFile");return o||console.error(`<StaticShape> missing shape for datablock: ${t}`),(0,d.jsx)(ri,{type:"StaticShape",object:e,shapeName:o,children:(0,d.jsx)("group",{position:n,quaternion:i,scale:a,children:(0,d.jsx)(rm,{})})})},Sun:function({object:e}){let t=(0,f.useMemo)(()=>{let[t,r,n]=((0,ey.getProperty)(e,"direction")??"0.57735 0.57735 -0.57735").split(" ").map(e=>parseFloat(e)),i=Math.sqrt(t*t+n*n+r*r);return new p.Vector3(t/i,n/i,r/i)},[e]),r=(0,f.useMemo)(()=>new p.Vector3(-(5e3*t.x),-(5e3*t.y),-(5e3*t.z)),[t]),n=(0,f.useMemo)(()=>{let[t,r,n]=((0,ey.getProperty)(e,"color")??"0.7 0.7 0.7 1").split(" ").map(e=>parseFloat(e));return new p.Color(t,r,n)},[e]),i=(0,f.useMemo)(()=>{let[t,r,n]=((0,ey.getProperty)(e,"ambient")??"0.5 0.5 0.5 1").split(" ").map(e=>parseFloat(e));return new p.Color(t,r,n)},[e]),a=t.y<0;return(0,f.useEffect)(()=>{eE.value=a},[a]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("directionalLight",{position:r,color:n,intensity:1,castShadow:!0,"shadow-mapSize-width":8192,"shadow-mapSize-height":8192,"shadow-camera-left":-4096,"shadow-camera-right":4096,"shadow-camera-top":4096,"shadow-camera-bottom":-4096,"shadow-camera-near":100,"shadow-camera-far":12e3,"shadow-bias":-1e-5,"shadow-normalBias":.4,"shadow-radius":2}),(0,d.jsx)("ambientLight",{color:i,intensity:1})]})},TerrainBlock:eP,TSStatic:function({object:e}){let t=(0,ey.getProperty)(e,"shapeName"),r=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),n=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]),i=(0,f.useMemo)(()=>(0,ey.getScale)(e),[e]);return t||console.error("<TSStatic> missing shapeName for object",e),(0,d.jsx)(ri,{type:"TSStatic",object:e,shapeName:t,children:(0,d.jsx)("group",{position:r,quaternion:n,scale:i,children:(0,d.jsx)(rm,{})})})},Turret:function({object:e}){let t=(0,ey.getProperty)(e,"dataBlock")??"",r=(0,ey.getProperty)(e,"initialBarrel"),n=(0,rA.useDatablock)(t),i=(0,rA.useDatablock)(r),a=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),o=(0,f.useMemo)(()=>(0,ey.getRotation)(e),[e]),s=(0,f.useMemo)(()=>(0,ey.getScale)(e),[e]),l=(0,ey.getProperty)(n,"shapeFile"),u=(0,ey.getProperty)(i,"shapeFile");return l||console.error(`<Turret> missing shape for datablock: ${t}`),r&&!u&&console.error(`<Turret> missing shape for barrel datablock: ${r}`),(0,d.jsx)(ri,{type:"Turret",object:e,shapeName:l,children:(0,d.jsxs)("group",{position:a,quaternion:o,scale:s,children:[(0,d.jsx)(rm,{}),u?(0,d.jsx)(ri,{type:"Turret",object:e,shapeName:u,children:(0,d.jsx)("group",{position:[0,1.5,0],children:(0,d.jsx)(rm,{})})}):null]})})},WaterBlock:(0,f.lazy)(()=>e.A(18599).then(e=>({default:e.WaterBlock}))),WayPoint:function({object:e}){let t=(0,f.useMemo)(()=>(0,ey.getPosition)(e),[e]),r=(0,ey.getProperty)(e,"name");return r?(0,d.jsx)(tj.FloatingLabel,{position:t,opacity:.6,children:r}):null}};function rM({object:e}){let{missionType:t}=(0,f.useContext)(ry),r=(0,f.useMemo)(()=>{let r=new Set(((0,ey.getProperty)(e,"missionTypesList")??"").toLowerCase().split(/s+/).filter(Boolean));return!r.size||r.has(t.toLowerCase())},[e,t]),n=rE[e._className];return r&&n?(0,d.jsx)(f.Suspense,{children:(0,d.jsx)(n,{object:e})}):null}var rS=e.i(86608),rF=e.i(38433),rT=e.i(33870),rR=e.i(91996);let rw=async e=>{let t;try{t=(0,ev.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}},rD=(0,rT.createScriptCache)(),rI={findFiles:e=>{let t=(0,eg.default)(e,{nocase:!0});return(0,rR.getResourceList)().filter(e=>t(e)).map(e=>{let[,t]=(0,rR.getSourceAndPath)(e);return t})},isFile:e=>null!=(0,rR.getResourceMap)()[(0,rR.getResourceKey)(e)]},rG=(0,f.memo)(function({name:e,missionType:t,onLoadingChange:r}){let{data:n}=eA({queryKey:["parsedMission",e],queryFn:()=>(0,ev.loadMission)(e)},ea,void 0),{missionGroup:i,runtime:a,progress:o}=function(e,t,r){let[n,i]=(0,f.useState)({missionGroup:void 0,runtime:void 0,progress:0});return(0,f.useEffect)(()=>{if(!r)return;let n=new AbortController,a=(0,rF.createProgressTracker)(),o=()=>{i(e=>({...e,progress:a.progress}))};a.on("update",o);let{runtime:s}=(0,rS.runServer)({missionName:e,missionType:t,runtimeOptions:{loadScript:rw,fileSystem:rI,cache:rD,signal:n.signal,progress:a,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:()=>{i({missionGroup:s.getObjectByName("MissionGroup"),runtime:s,progress:1})}});return()=>{a.off("update",o),n.abort(),s.destroy()}},[e,r]),n}(e,t,n),s=!n||!i||!a,l=(0,f.useMemo)(()=>({metadata:n,missionType:t,missionGroup:i}),[n,t,i]);return((0,f.useEffect)(()=>{r?.(s,o)},[s,o,r]),s)?null:(0,d.jsx)(rb,{value:l,children:(0,d.jsx)(eG.RuntimeProvider,{runtime:a,children:(0,d.jsx)(rM,{object:i})})})});var rL=class extends b{constructor(e={}){super(),this.config=e,this.#_=new Map}#_;build(e,t,r){let n=t.queryKey,i=t.queryHash??G(n,t),a=this.get(i);return a||(a=new et({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#_.has(e.queryHash)||(this.#_.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#_.get(e.queryHash);t&&(e.destroy(),t===e&&this.#_.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){q.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#_.get(e)}getAll(){return[...this.#_.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>D(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>D(e,t)):t}notify(e){q.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){q.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){q.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rO=class extends ee{#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=$({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{throw await this.#U.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#U.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#m({type:"error",error: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),q.batch(()=>{this.#k.forEach(t=>{t.onMutationUpdate(e)}),this.#U.notify({mutation:this,type:"updated",action:e})})}},rP=class extends b{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 rO({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=rH(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=rH(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=rH(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=rH(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(){q.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=>I(t,e))}findAll(e={}){return this.getAll().filter(t=>I(e,t))}notify(e){q.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return q.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function rH(e){return e.options.scope?.id}function r_(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=Q(t.options,t.fetchOptions),c=async(e,n,i)=>{let a;if(r)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let o=(Object.defineProperty(a={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?"backward":"forward",meta:t.options.meta},"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)}),a),s=await u(o),{maxPages:l}=t.options,c=i?J:N;return{pages:c(e.pages,s,l),pageParams:c(e.pageParams,n,l)}};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}:rk)(n,t);s=await c(t,r,e)}else{let t=e??a.length;do{let e=0===l?o[0]??n.initialPageParam:rk(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 rk(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 rU=class{#K;#U;#f;#Q;#V;#q;#X;#W;constructor(e={}){this.#K=e.queryCache||new rL,this.#U=e.mutationCache||new rP,this.#f=e.defaultOptions||{},this.#Q=new Map,this.#V=new Map,this.#q=0}mount(){this.#q++,1===this.#q&&(this.#X=V.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#K.onFocus())}),this.#W=X.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(R(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 q.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;q.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#K;return q.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(q.batch(()=>this.#K.findAll(e).map(e=>e.cancel(r)))).then(S).catch(S)}invalidateQueries(e,t={}){return q.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(q.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(S)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#K.build(this,t);return r.isStaleByTime(R(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e.behavior=r_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e.behavior=r_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return X.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(L(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#Q.values()],r={};return t.forEach(t=>{O(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#V.set(L(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#V.values()],r={};return t.forEach(t=>{O(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=G(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===K&&(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()}},rj=e.i(8155);let rN=e=>{let t=(0,rj.createStore)(e),r=e=>(function(e,t=e=>e){let r=f.default.useSyncExternalStore(e.subscribe,f.default.useCallback(()=>t(e.getState()),[e,t]),f.default.useCallback(()=>t(e.getInitialState()),[e,t]));return f.default.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},rJ=f.createContext(null);function rK({map:e,children:t,onChange:r,domElement:n}){let i=e.map(e=>e.name+e.keys).join("-"),a=f.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)})?rN(r):rN},[i]),o=f.useMemo(()=>[a.subscribe,a.getState,a],[i]),s=a.setState;return f.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]),f.createElement(rJ.Provider,{value:o,children:t})}var rQ=Object.defineProperty;class rV{constructor(){((e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?rQ(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 rq=Object.defineProperty,rX=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?rq(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let rW=new p.Euler(0,0,0,"YXZ"),rY=new p.Vector3,rz={type:"change"},rZ={type:"lock"},r$={type:"unlock"},r0=Math.PI/2;class r1 extends rV{constructor(e,t){super(),rX(this,"camera"),rX(this,"domElement"),rX(this,"isLocked"),rX(this,"minPolarAngle"),rX(this,"maxPolarAngle"),rX(this,"pointerSpeed"),rX(this,"onMouseMove",e=>{this.domElement&&!1!==this.isLocked&&(rW.setFromQuaternion(this.camera.quaternion),rW.y-=.002*e.movementX*this.pointerSpeed,rW.x-=.002*e.movementY*this.pointerSpeed,rW.x=Math.max(r0-this.maxPolarAngle,Math.min(r0-this.minPolarAngle,rW.x)),this.camera.quaternion.setFromEuler(rW),this.dispatchEvent(rz))}),rX(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(rZ),this.isLocked=!0):(this.dispatchEvent(r$),this.isLocked=!1))}),rX(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),rX(this,"connect",e=>{this.domElement=e||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),rX(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),rX(this,"dispose",()=>{this.disconnect()}),rX(this,"getObject",()=>this.camera),rX(this,"direction",new p.Vector3(0,0,-1)),rX(this,"getDirection",e=>e.copy(this.direction).applyQuaternion(this.camera.quaternion)),rX(this,"moveForward",e=>{rY.setFromMatrixColumn(this.camera.matrix,0),rY.crossVectors(this.camera.up,rY),this.camera.position.addScaledVector(rY,e)}),rX(this,"moveRight",e=>{rY.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(rY,e)}),rX(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),rX(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var r9=((c=r9||{}).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);function r2(){let{speedMultiplier:e,setSpeedMultiplier:t}=(0,eS.useControls)(),[r,n]=function(e){let[t,r,n]=f.useContext(rJ);return[t,r]}(),{camera:i,gl:a}=(0,eB.useThree)(),{nextCamera:o,setCameraIndex:s,cameraCount:l}=rC(),u=(0,f.useRef)(null),c=(0,f.useRef)(new p.Vector3),d=(0,f.useRef)(new p.Vector3),h=(0,f.useRef)(new p.Vector3);return(0,f.useEffect)(()=>{let e=new r1(i,a.domElement);return u.current=e,()=>{e.dispose()}},[i,a.domElement]),(0,f.useEffect)(()=>{let e=e=>{let t=u.current;!t||t.isLocked?o():e.target===a.domElement&&t.lock()};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[o]),(0,f.useEffect)(()=>{let e=["camera1","camera2","camera3","camera4","camera5","camera6","camera7","camera8","camera9"];return r(t=>{for(let r=0;r<e.length;r++)if(t[e[r]]&&r<l){s(r);break}})},[r,s,l]),(0,f.useEffect)(()=>{let e=e=>{e.preventDefault();let r=e.deltaY>0?-1:1,n=Math.max(.05,Math.min(.5,Math.abs(.01*e.deltaY)))*r;t(e=>Math.max(.1,Math.min(5,Math.round((e+n)*20)/20)))},r=a.domElement;return r.addEventListener("wheel",e,{passive:!1}),()=>{r.removeEventListener("wheel",e)}},[a]),(0,eC.useFrame)((t,r)=>{let{forward:a,backward:o,left:s,right:l,up:u,down:f}=n();(a||o||s||l||u||f)&&(i.getWorldDirection(c.current),c.current.normalize(),d.current.crossVectors(i.up,c.current).normalize(),h.current.set(0,0,0),a&&h.current.add(c.current),o&&h.current.sub(c.current),s&&h.current.add(d.current),l&&h.current.sub(d.current),u&&(h.current.y+=1),f&&(h.current.y-=1),h.current.lengthSq()>0&&(h.current.normalize().multiplyScalar(80*e*r),i.position.add(h.current)))}),null}let r3=[{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 r8(){return(0,f.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key||e.metaKey&&e.stopImmediatePropagation()};return window.addEventListener("keydown",e,{capture:!0}),window.addEventListener("keyup",e,{capture:!0}),()=>{window.removeEventListener("keydown",e,{capture:!0}),window.removeEventListener("keyup",e,{capture:!0})}},[]),(0,d.jsx)(rK,{map:r3,children:(0,d.jsx)(r2,{})})}var r5="undefined"!=typeof window&&!!(null==(u=window.document)?void 0:u.createElement);function r6(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function r4(e){return e?"self"in e?e.self:r6(e).defaultView||window:self}function r7(e,t=!1){let{activeElement:r}=r6(e);if(!(null==r?void 0:r.nodeName))return null;if(nt(r)&&r.contentDocument)return r7(r.contentDocument.body,t);if(t){let e=r.getAttribute("aria-activedescendant");if(e){let t=r6(r).getElementById(e);if(t)return t}}return r}function ne(e,t){return e===t||e.contains(t)}function nt(e){return"IFRAME"===e.tagName}function nr(e){let t=e.tagName.toLowerCase();return"button"===t||"input"===t&&!!e.type&&-1!==nn.indexOf(e.type)}var nn=["button","color","file","image","reset","submit"];function ni(e){return"function"==typeof e.checkVisibility?e.checkVisibility():e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0}function na(e){try{let t=e instanceof HTMLInputElement&&null!==e.selectionStart,r="TEXTAREA"===e.tagName;return t||r||!1}catch(e){return!1}}function no(e){return e.isContentEditable||na(e)}function ns(e){let t=0,r=0;if(na(e))t=e.selectionStart||0,r=e.selectionEnd||0;else if(e.isContentEditable){let n=r6(e).getSelection();if((null==n?void 0:n.rangeCount)&&n.anchorNode&&ne(e,n.anchorNode)&&n.focusNode&&ne(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 nl(e,t){let r=null==e?void 0:e.getAttribute("role");return r&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(r)?r:t}function nu(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 nu(e.parentElement)||document.scrollingElement||document.body}function nc(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function nd(e,t){return t&&e.item(t)||null}var nf=Symbol("FOCUS_SILENTLY");function nh(e,t,r){if(!t||t===r)return!1;let n=e.item(t.id);return!!n&&(!r||n.element!==r)}function nm(){}function np(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nA(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}function ng(e){return e}function nv(e,t){if(!e){if("string"!=typeof t)throw Error("Invariant failed");throw Error(t)}}function nC(e,...t){let r="function"==typeof e?e(...t):e;return null!=r&&!r}function nB(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function ny(e){let t={};for(let r in e)void 0!==e[r]&&(t[r]=e[r]);return t}function nb(...e){for(let t of e)if(void 0!==t)return t}function nx(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function nE(){return r5&&!!navigator.maxTouchPoints}function nM(){return!!r5&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function nS(){return r5&&nM()&&/apple/i.test(navigator.vendor)}function nF(e){return!!(e.currentTarget&&!ne(e.currentTarget,e.target))}function nT(e){return e.target===e.currentTarget}function nR(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 nw(e,t){let r=new MouseEvent("click",t);return e.dispatchEvent(r)}function nD(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!ne(r,n)}function nI(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 nG(e,t,r,n=window){let i=[];try{for(let a of(n.document.addEventListener(e,t,r),Array.from(n.frames)))i.push(nG(e,t,r,a))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,r)}catch(e){}for(let e of i)e()}}var nL={...f},nO=nL.useId;nL.useDeferredValue;var nP=nL.useInsertionEffect,nH=r5?f.useLayoutEffect:f.useEffect;function n_(e){let t=(0,f.useRef)(()=>{throw Error("Cannot call an event handler while rendering.")});return nP?nP(()=>{t.current=e}):t.current=e,(0,f.useCallback)((...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}function nk(...e){return(0,f.useMemo)(()=>{if(e.some(Boolean))return t=>{for(let r of e)nx(r,t)}},e)}function nU(e){if(nO){let t=nO();return e||t}let[t,r]=(0,f.useState)(e);return nH(()=>{if(e||t)return;let n=Math.random().toString(36).slice(2,8);r(`id-${n}`)},[e,t]),e||t}function nj(e,t){let r=(0,f.useRef)(!1);(0,f.useEffect)(()=>{if(r.current)return e();r.current=!0},t),(0,f.useEffect)(()=>()=>{r.current=!1},[])}function nN(){return(0,f.useReducer)(()=>[],[])}function nJ(e){return n_("function"==typeof e?e:()=>e)}function nK(e,t,r=[]){let n=(0,f.useCallback)(r=>(e.wrapElement&&(r=e.wrapElement(r)),t(r)),[...r,e.wrapElement]);return{...e,wrapElement:n}}function nQ(e=!1,t){let[r,n]=(0,f.useState)(null);return{portalRef:nk(n,t),portalNode:r,domReady:!e||r}}var nV=!1,nq=!1,nX=0,nW=0;function nY(e){let t,r;t=e.movementX||e.screenX-nX,r=e.movementY||e.screenY-nW,nX=e.screenX,nW=e.screenY,(t||r||0)&&(nq=!0)}function nz(){nq=!1}function nZ(e){let t=f.forwardRef((t,r)=>e({...t,ref:r}));return t.displayName=e.displayName||e.name,t}function n$(e,t){return f.memo(e,t)}function n0(e,t){let r,{wrapElement:n,render:i,...a}=t,o=nk(t.ref,i&&(0,f.isValidElement)(i)&&("ref"in i.props||"ref"in i)?({...i.props}).ref||i.ref:null);if(f.isValidElement(i)){let e={...i.props,ref:o};r=f.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 n1(e){let t=(t={})=>e(t);return t.displayName=e.name,t}function n9(e=[],t=[]){let r=f.createContext(void 0),n=f.createContext(void 0),i=()=>f.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=f.useContext(n),r=i();return e?t:t||r},useProviderContext:()=>{let e=f.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 n2=n9(),n3=n2.useContext;n2.useScopedContext,n2.useProviderContext;var n8=n9([n2.ContextProvider],[n2.ScopedContextProvider]),n5=n8.useContext;n8.useScopedContext;var n6=n8.useProviderContext,n4=n8.ContextProvider,n7=n8.ScopedContextProvider,ie=(0,f.createContext)(void 0),it=(0,f.createContext)(void 0),ir=(0,f.createContext)(!0),ii="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 ia(e){return!(!e.matches(ii)||!ni(e)||e.closest("[inert]"))}function io(e){if(!ia(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=r7(e);return!r||r===e||!("form"in r)||r.form!==e.form||r.name!==e.name}function is(e,t){let r=Array.from(e.querySelectorAll(ii));t&&r.unshift(e);let n=r.filter(ia);return n.forEach((e,t)=>{if(nt(e)&&e.contentDocument){let r=e.contentDocument.body;n.splice(t,1,...is(r))}}),n}function il(e,t,r){let n=Array.from(e.querySelectorAll(ii)),i=n.filter(io);return(t&&io(e)&&i.unshift(e),i.forEach((e,t)=>{if(nt(e)&&e.contentDocument){let n=il(e.contentDocument.body,!1,r);i.splice(t,1,...n)}}),!i.length&&r)?n:i}function iu(e,t){var r;let n,i,a,o;return r=document.body,n=r7(r),a=(i=is(r,!1)).indexOf(n),(o=i.slice(a+1)).find(io)||(e?i.find(io):null)||(t?o[0]:null)||null}function ic(e,t){var r;let n,i,a,o;return r=document.body,n=r7(r),a=(i=is(r,!1).reverse()).indexOf(n),(o=i.slice(a+1)).find(io)||(e?i.find(io):null)||(t?o[0]:null)||null}function id(e){let t=r7(e);if(!t)return!1;if(t===e)return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&r===e.id}function ih(e){let t=r7(e);if(!t)return!1;if(ne(e,t))return!0;let r=t.getAttribute("aria-activedescendant");return!!r&&"id"in e&&(r===e.id||!!e.querySelector(`#${CSS.escape(r)}`))}function im(e){!ih(e)&&ia(e)&&e.focus()}var ip=nS(),iA=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],ig=Symbol("safariFocusAncestor");function iv(e){return"input"===e.tagName.toLowerCase()&&!!e.type&&("radio"===e.type||"checkbox"===e.type)}function iC(e,t){return n_(r=>{null==e||e(r),!r.defaultPrevented&&t&&(r.stopPropagation(),r.preventDefault())})}var iB=!1,iy=!0;function ib(e){let t=e.target;t&&"hasAttribute"in t&&!t.hasAttribute("data-focus-visible")&&(iy=!1)}function ix(e){e.metaKey||e.ctrlKey||e.altKey||(iy=!0)}var iE=n1(function({focusable:e=!0,accessibleWhenDisabled:t,autoFocus:r,onFocusVisible:n,...i}){var a,o,s,l,u;let c=(0,f.useRef)(null);(0,f.useEffect)(()=>{!e||iB||(nG("mousedown",ib,!0),nG("keydown",ix,!0),iB=!0)},[e]),ip&&(0,f.useEffect)(()=>{if(!e)return;let t=c.current;if(!t||!iv(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&&nB(i),h=!!d&&!t,[m,p]=(0,f.useState)(!1);(0,f.useEffect)(()=>{e&&h&&m&&p(!1)},[e,h,m]),(0,f.useEffect)(()=>{if(!e||!m)return;let t=c.current;if(!t||"undefined"==typeof IntersectionObserver)return;let r=new IntersectionObserver(()=>{ia(t)||p(!1)});return r.observe(t),()=>r.disconnect()},[e,m]);let A=iC(i.onKeyPressCapture,d),g=iC(i.onMouseDownCapture,d),v=iC(i.onClickCapture,d),C=i.onMouseDown,B=n_(t=>{if(null==C||C(t),t.defaultPrevented||!e)return;let r=t.currentTarget;if(!ip||nF(t)||!nr(r)&&!iv(r))return;let n=!1,i=()=>{n=!0};r.addEventListener("focusin",i,{capture:!0,once:!0});let a=function(e){for(;e&&!ia(e);)e=e.closest(ii);return e||null}(r.parentElement);a&&(a[ig]=!0),nI(r,"mouseup",()=>{r.removeEventListener("focusin",i,!0),a&&(a[ig]=!1),n||im(r)})}),y=(t,r)=>{if(r&&(t.currentTarget=r),!e)return;let i=t.currentTarget;i&&id(i)&&(null==n||n(t),t.defaultPrevented||(i.dataset.focusVisible="true",p(!0)))},b=i.onKeyDownCapture,x=n_(t=>{if(null==b||b(t),t.defaultPrevented||!e||m||t.metaKey||t.altKey||t.ctrlKey||!nT(t))return;let r=t.currentTarget;nI(r,"focusout",()=>y(t,r))}),E=i.onFocusCapture,M=n_(t=>{if(null==E||E(t),t.defaultPrevented||!e)return;if(!nT(t))return void p(!1);let r=t.currentTarget;iy||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:iA.includes(n))}(t.target)?nI(t.target,"focusout",()=>y(t,r)):p(!1)}),S=i.onBlur,F=n_(t=>{null==S||S(t),!e||nD(t)&&(t.currentTarget.removeAttribute("data-focus-visible"),p(!1))}),T=(0,f.useContext)(ir),R=n_(t=>{e&&r&&t&&T&&queueMicrotask(()=>{id(t)||ia(t)&&t.focus()})}),w=function(e,t){let r=e=>{if("string"==typeof e)return e},[n,i]=(0,f.useState)(()=>r(void 0));return nH(()=>{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,f.useMemo)(()=>h?{pointerEvents:"none",...G}:G,[h,G]);return i={"data-focus-visible":e&&m||void 0,"data-autofocus":r||void 0,"aria-disabled":d||void 0,...i,ref:nk(c,R,i.ref),style:L,tabIndex:(a=e,o=h,s=D,l=I,u=i.tabIndex,a?o?s&&!l?-1:void 0:s?u:u||0:u),disabled:!!I&&!!h||void 0,contentEditable:d?void 0:i.contentEditable,onKeyPressCapture:A,onClickCapture:v,onMouseDownCapture:g,onMouseDown:B,onKeyDownCapture:x,onFocusCapture:M,onBlur:F},ny(i)});function iM(e){let t=[];for(let r of e)t.push(...r);return t}function iS(e){return e.slice().reverse()}function iF(e,t,r){return n_(n=>{var i;let a,o;if(null==t||t(n),n.defaultPrevented||n.isPropagationStopped()||!nT(n)||"Shift"===n.key||"Control"===n.key||"Alt"===n.key||"Meta"===n.key||(!(a=n.target)||na(a))&&1===n.key.length&&!n.ctrlKey&&!n.metaKey)return;let s=e.getState(),l=null==(i=nd(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()})}nZ(function(e){return n0("div",iE(e))});var iT=n1(function({store:e,composite:t=!0,focusOnMove:r=t,moveOnKeyPress:n=!0,...i}){let a=n6();nv(e=e||a,!1);let o=(0,f.useRef)(null),s=(0,f.useRef)(null),l=function(e){let[t,r]=(0,f.useState)(!1),n=(0,f.useCallback)(()=>r(!0),[]),i=e.useState(t=>nd(e,t.activeId));return(0,f.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,f.useState)(null);return nH(()=>{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,f.useEffect)(()=>{var n;if(!e||!u||!t||!r)return;let{activeId:i}=e.getState(),a=null==(n=nd(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]),nH(()=>{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&&nR(i,{relatedTarget:r}),id(r)||r.focus()},[e,u,t]);let h=e.useState("activeId"),m=e.useState("virtualFocus");nH(()=>{var r;if(!e||!t||!m)return;let n=s.current;if(s.current=null,!n)return;let i=(null==(r=nd(e,h))?void 0:r.element)||r7(n);i!==n&&nR(n,{relatedTarget:i})},[e,h,m,t]);let p=iF(e,i.onKeyDownCapture,s),A=iF(e,i.onKeyUpCapture,s),g=i.onFocusCapture,v=n_(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)[nf],delete r[nf],n);nT(t)&&o&&(t.stopPropagation(),s.current=a)}),C=i.onFocus,B=n_(r=>{if(null==C||C(r),r.defaultPrevented||!t||!e)return;let{relatedTarget:n}=r,{virtualFocus:i}=e.getState();i?nT(r)&&!nh(e,n)&&queueMicrotask(l):nT(r)&&e.setActiveId(null)}),y=i.onBlurCapture,b=n_(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=nd(e,i))?void 0:r.element,o=t.relatedTarget,l=nh(e,o),u=s.current;s.current=null,nT(t)&&l?(o===a?u&&u!==o&&nR(u,t):a?nR(a,t):u&&nR(u,t),t.stopPropagation()):!nh(e,t.target)&&a&&nR(a,t)}),x=i.onKeyDown,E=nJ(n),M=n_(t=>{var r;if(null==x||x(t),t.nativeEvent.isComposing||t.defaultPrevented||!e||!nT(t))return;let{orientation:n,renderedItems:i,activeId:a}=e.getState(),o=nd(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)&&na(t.currentTarget))return;let c={ArrowUp:(u||s)&&(()=>{if(u){let e=iM(iS(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=nK(i,t=>(0,d.jsx)(n4,{value:e,children:t}),[e]),i={"aria-activedescendant":e.useState(r=>{var n;if(e&&t&&r.virtualFocus)return null==(n=nd(e,r.activeId))?void 0:n.id}),...i,ref:nk(o,c,i.ref),onKeyDownCapture:p,onKeyUpCapture:A,onFocusCapture:v,onFocus:B,onBlurCapture:b,onKeyDown:M},i=iE({focusable:e.useState(e=>t&&(e.virtualFocus||null===e.activeId)),...i})});nZ(function(e){return n0("div",iT(e))});var iR=n9();iR.useContext,iR.useScopedContext;var iw=iR.useProviderContext,iD=n9([iR.ContextProvider],[iR.ScopedContextProvider]);iD.useContext,iD.useScopedContext;var iI=iD.useProviderContext,iG=iD.ContextProvider,iL=iD.ScopedContextProvider,iO=(0,f.createContext)(void 0),iP=(0,f.createContext)(void 0),iH=n9([iG],[iL]);iH.useContext,iH.useScopedContext;var i_=iH.useProviderContext,ik=iH.ContextProvider,iU=iH.ScopedContextProvider,ij=n1(function({store:e,...t}){let r=i_();return e=e||r,t={...t,ref:nk(null==e?void 0:e.setAnchorElement,t.ref)}});nZ(function(e){return n0("div",ij(e))});var iN=(0,f.createContext)(void 0),iJ=n9([ik,n4],[iU,n7]),iK=iJ.useContext,iQ=iJ.useScopedContext,iV=iJ.useProviderContext,iq=iJ.ContextProvider,iX=iJ.ScopedContextProvider,iW=(0,f.createContext)(void 0),iY=(0,f.createContext)(!1);function iz(e,t){let r=e.__unstableInternals;return nv(r,"Invalid store"),r[t]}function iZ(e,...t){let r=e,n=r,i=Symbol(),a=nm,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=>nA(...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 i9(t,[e],t=>{m(e,t[e],!0)})}))),u=[];for(let e of l)u.push(e());return a=nA(...s,...u,...t.map(i0)),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=>iZ(function(e,t){let r={};for(let n of t)np(e,n)&&(r[n]=e[n]);return r}(r,e),p),omit:e=>iZ(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 i$(e,...t){if(e)return iz(e,"setup")(...t)}function i0(e,...t){if(e)return iz(e,"init")(...t)}function i1(e,...t){if(e)return iz(e,"subscribe")(...t)}function i9(e,...t){if(e)return iz(e,"sync")(...t)}function i2(e,...t){if(e)return iz(e,"batch")(...t)}function i3(e,...t){if(e)return iz(e,"omit")(...t)}function i8(...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=iZ(r,...e);return Object.assign({},...e,n)}function i5(e,t){}function i6(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 i4(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 i7=n1(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:h=!0,moveOnKeyPress:m=!0,autoComplete:p="list",...A}){var g;let v,C=iV();nv(e=e||C,!1);let B=(0,f.useRef)(null),[y,b]=nN(),x=(0,f.useRef)(!1),E=(0,f.useRef)(!1),M=e.useState(e=>e.virtualFocus&&r),S="inline"===p||"both"===p,[F,T]=(0,f.useState)(S);g=[S],v=(0,f.useRef)(!1),nH(()=>{if(v.current)return(()=>{S&&T(!0)})();v.current=!0},g),nH(()=>()=>{v.current=!1},[]);let R=e.useState("value"),w=(0,f.useRef)();(0,f.useEffect)(()=>i9(e,["selectedValue","activeId"],(e,t)=>{w.current=t.selectedValue}),[]);let D=e.useState(e=>{var t;if(S&&F){if(e.activeValue&&Array.isArray(e.selectedValue)&&(e.selectedValue.includes(e.activeValue)||(null==(t=w.current)?void 0:t.includes(e.activeValue))))return;return e.activeValue}}),I=e.useState("renderedItems"),G=e.useState("open"),L=e.useState("contentElement"),O=(0,f.useMemo)(()=>{if(!S||!F)return R;if(i6(I,D,M)){if(i4(R,D)){let e=(null==D?void 0:D.slice(R.length))||"";return R+e}return R}return D||R},[S,F,I,D,M,R]);(0,f.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,f.useEffect)(()=>{if(!S||!F||!D||!i6(I,D,M)||!i4(R,D))return;let e=nm;return queueMicrotask(()=>{let t=B.current;if(!t)return;let{start:r,end:n}=ns(t),i=R.length,a=D.length;nc(t,i,a),e=()=>{if(!id(t))return;let{start:e,end:o}=ns(t);e!==i||o===a&&nc(t,r,n)}}),()=>e()},[y,S,F,D,I,M,R]);let P=(0,f.useRef)(null),H=n_(n),_=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!G||!L)return;let t=nu(L);if(!t)return;P.current=t;let r=()=>{x.current=!1},n=()=>{if(!e||!x.current)return;let{activeId:t}=e.getState();null===t||t!==_.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]),nH(()=>{!R||E.current||(x.current=!0)},[R]),nH(()=>{"always"!==M&&G||(x.current=G)},[M,G]);let k=e.useState("resetValueOnSelect");nj(()=>{var t,r;let n=x.current;if(!e||!G||!n&&!k)return;let{baseElement:i,contentElement:a,activeId:o}=e.getState();if(!i||id(i)){if(null==a?void 0:a.hasAttribute("data-placing")){let e=new MutationObserver(b);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(M&&n){let r,n=H(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();_.current=i,e.move(null!=i?i:null)}else{let t=null==(r=e.item(o||e.first()))?void 0:r.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}},[e,G,y,R,M,k,H,I]),(0,f.useEffect)(()=>{if(!S)return;let t=B.current;if(!t)return;let r=[t,L].filter(e=>!!e),n=t=>{r.every(e=>nD(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)}},[S,L,e,O]);let U=e=>e.currentTarget.value.length>=a,j=A.onChange,N=nJ(null!=o?o:U),J=nJ(null!=i?i:!e.tag),K=n_(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),S)){let e="insertText"===o.inputType||"insertCompositionText"===o.inputType,t=i===n.length;T(e&&t)}if(J(t)){let t=n===e.getState().value;e.setValue(n),queueMicrotask(()=>{nc(r,i,a)}),S&&M&&t&&b()}N(t)&&e.show(),M&&x.current||e.setActiveId(null)}),Q=A.onCompositionEnd,V=n_(e=>{x.current=!0,E.current=!1,null==Q||Q(e),e.defaultPrevented||M&&b()}),q=A.onMouseDown,X=nJ(null!=d?d:()=>!!(null==e?void 0:e.getState().includesBaseElement)),W=nJ(h),Y=nJ(null!=l?l:U),z=n_(t=>{null==q||q(t),t.defaultPrevented||t.button||t.ctrlKey||e&&(X(t)&&e.setActiveId(null),W(t)&&e.setValue(O),Y(t)&&nI(t.currentTarget,"mouseup",e.show))}),Z=A.onKeyDown,$=nJ(null!=c?c:U),ee=n_(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=n_(e=>{if(x.current=!1,null==et||et(e),e.defaultPrevented)return}),en=nU(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":nl(L,"listbox"),"aria-expanded":G,"aria-controls":null==L?void 0:L.id,"data-active-item":ei||void 0,value:O,...A,ref:nk(B,A.ref),onChange:K,onCompositionEnd:V,onMouseDown:z,onKeyDown:ee,onBlur:er},A=iT({store:e,focusable:t,...A,moveOnKeyPress:e=>!nC(m,e)&&(S&&T(!0),!0)}),{autoComplete:"off",...A=ij({store:e,...A})}}),ae=nZ(function(e){return n0("input",i7(e))});function at(e){let t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var ar=Symbol("composite-hover"),an=n1(function({store:e,focusOnHover:t=!0,blurOnHoverEnd:r=!!t,...n}){let i=n5();nv(e=e||i,!1);let a=((0,f.useEffect)(()=>{nV||(nG("mousemove",nY,!0),nG("mousedown",nz,!0),nG("mouseup",nz,!0),nG("keydown",nz,!0),nG("scroll",nz,!0),nV=!0)},[]),n_(()=>nq)),o=n.onMouseMove,s=nJ(t),l=n_(t=>{if((null==o||o(t),!t.defaultPrevented&&a())&&s(t)){if(!ih(t.currentTarget)){let t=null==e?void 0:e.getState().baseElement;t&&!id(t)&&t.focus()}null==e||e.setActiveId(t.currentTarget.id)}}),u=n.onMouseLeave,c=nJ(r),d=n_(t=>{var r;let n;null==u||u(t),!t.defaultPrevented&&a()&&((n=at(t))&&ne(t.currentTarget,n)||function(e){let t=at(e);if(!t)return!1;do{if(np(t,ar)&&t[ar])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()))}),h=(0,f.useCallback)(e=>{e&&(e[ar]=!0)},[]);return ny(n={...n,ref:nk(h,n.ref),onMouseMove:l,onMouseLeave:d})});n$(nZ(function(e){return n0("div",an(e))}));var ai=n1(function({store:e,shouldRegisterItem:t=!0,getItem:r=ng,element:n,...i}){let a=n3();e=e||a;let o=nU(i.id),s=(0,f.useRef)(n);return(0,f.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]),ny(i={...i,ref:nk(s,i.ref)})});function aa(e){if(!e.isTrusted)return!1;let t=e.currentTarget;return"Enter"===e.key?nr(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(nr(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}nZ(function(e){return n0("div",ai(e))});var ao=Symbol("command"),as=n1(function({clickOnEnter:e=!0,clickOnSpace:t=!0,...r}){let n,i,a=(0,f.useRef)(null),[o,s]=(0,f.useState)(!1);(0,f.useEffect)(()=>{a.current&&s(nr(a.current))},[]);let[l,u]=(0,f.useState)(!1),c=(0,f.useRef)(!1),d=nB(r),[h,m]=(n=r.onLoadedMetadataCapture,i=(0,f.useMemo)(()=>Object.assign(()=>{},{...n,[ao]:!0}),[n,ao,!0]),[null==n?void 0:n[ao],{onLoadedMetadataCapture:i}]),p=r.onKeyDown,A=n_(r=>{null==p||p(r);let n=r.currentTarget;if(r.defaultPrevented||h||d||!nT(r)||na(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=aa(r);if(i){if(!e){r.preventDefault();let{view:e,...t}=r,i=()=>nw(n,t);r5&&/firefox\//i.test(navigator.userAgent)?nI(n,"keyup",i):queueMicrotask(i)}}else a&&(c.current=!0,e||(r.preventDefault(),u(!0)))}}),g=r.onKeyUp,v=n_(e=>{if(null==g||g(e),e.defaultPrevented||h||d||e.metaKey)return;let r=t&&" "===e.key;if(c.current&&r&&(c.current=!1,!aa(e))){e.preventDefault(),u(!1);let t=e.currentTarget,{view:r,...n}=e;queueMicrotask(()=>nw(t,n))}});return iE(r={"data-active":l||void 0,type:o?"button":void 0,...m,...r,ref:nk(a,r.ref),onKeyDown:A,onKeyUp:v})});nZ(function(e){return n0("button",as(e))});var{useSyncExternalStore:al}=e.i(2239).default,au=()=>()=>{};function ac(e,t=ng){let r=f.useCallback(t=>e?i1(e,null,t):au(),[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 al(r,n,n)}function ad(e,t){let r=f.useRef({}),n=f.useCallback(t=>e?i1(e,null,t):au(),[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 al(n,i,i)}function af(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,f.useRef)(i),nH(()=>{a.current=i}),a);nH(()=>i9(e,[r],(e,t)=>{let{value:n,setValue:i}=s.current;i&&e[r]!==t[r]&&e[r]!==n&&i(e[r])}),[e,r]),nH(()=>{if(void 0!==o)return e.setState(r,o),i2(e,[r],()=>{void 0!==o&&e.setState(r,o)})})}function ah(e,t){let[r,n]=f.useState(()=>e(t));nH(()=>i0(r),[r]);let i=f.useCallback(e=>ac(r,e),[r]);return[f.useMemo(()=>({...r,useState:i}),[r,i]),n_(()=>{n(r=>e({...t,...r.getState()}))})]}function am(e,t,r,n=!1){var i;let a,o;if(!t||!r)return;let{renderedItems:s}=t.getState(),l=nu(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=nd(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=n1(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=n5();e=e||u;let c=nU(l.id),h=(0,f.useRef)(null),m=(0,f.useContext)(it),p=nB(l)&&!l.accessibleWhenDisabled,{rowId:A,baseElement:g,isActiveItem:v,ariaSetSize:C,ariaPosInSet:B,isTabbable:y}=ad(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,f.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,f.useRef)(!1),M=n_(t=>{var r,n;if(null==x||x(t),t.defaultPrevented||nF(t)||!c||!e||(r=e,!nT(t)&&nh(r,t.target)))return;let{virtualFocus:i,baseElement:a}=e.getState();e.setActiveId(c),no(t.currentTarget)&&function(e,t=!1){if(na(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){let r=r6(e).getSelection();null==r||r.selectAllChildren(e),t&&(null==r||r.collapseToEnd())}}(t.currentTarget),!i||!nT(t)||!no(n=t.currentTarget)&&("INPUT"!==n.tagName||nr(n))&&(null==a?void 0:a.isConnected)&&((nS()&&t.currentTarget.hasAttribute("data-autofocus")&&t.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),E.current=!0,t.relatedTarget===a||nh(e,t.relatedTarget))?(a[nf]=!0,a.focus({preventScroll:!0})):a.focus())}),S=l.onBlurCapture,F=n_(t=>{if(null==S||S(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState();(null==r?void 0:r.virtualFocus)&&E.current&&(E.current=!1,t.preventDefault(),t.stopPropagation())}),T=l.onKeyDown,R=nJ(r),w=nJ(n),D=n_(t=>{if(null==T||T(t),t.defaultPrevented||!nT(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&&na(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:()=>am(r,e,null==e?void 0:e.up,!0),PageDown:()=>am(r,e,null==e?void 0:e.down)}[t.key];if(u){if(no(r)){let e=ns(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(na(e))return e.value;if(e.isContentEditable){let t=r6(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,f.useMemo)(()=>({id:c,baseElement:g}),[c,g]);return l={id:c,"data-active-item":v||void 0,...l=nK(l,e=>(0,d.jsx)(ie.Provider,{value:I,children:e}),[I]),ref:nk(h,l.ref),tabIndex:y?l.tabIndex:-1,onFocus:M,onBlurCapture:F,onKeyDown:D},l=as(l),ny({...l=ai({store:e,...l,getItem:b,shouldRegisterItem:!!c&&l.shouldRegisterItem}),"aria-setsize":C,"aria-posinset":B})});n$(nZ(function(e){return n0("button",ap(e))}));var aA=n1(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,h;let m=iQ();nv(e=e||m,!1);let{resetValueOnSelectState:p,multiSelectable:A,selected:g}=ad(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,f.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=nJ(n),y=nJ(i),b=nJ(null!=(c=null!=a?a:p)?c:A),x=nJ(r),E=n_(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=nM();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()))}),M=u.onKeyDown,S=n_(t=>{if(null==M||M(t),t.defaultPrevented)return;let r=null==e?void 0:e.getState().baseElement;!r||id(r)||(1===t.key.length||"Backspace"===t.key||"Delete"===t.key)&&(queueMicrotask(()=>r.focus()),na(r)&&(null==e||e.setValue(r.value)))});A&&null!=g&&(u={"aria-selected":g,...u}),u=nK(u,e=>(0,d.jsx)(iW.Provider,{value:t,children:(0,d.jsx)(iY.Provider,{value:null!=g&&g,children:e})}),[t,g]),u={role:null!=(h=({menu:"menuitem",listbox:"option",tree:"treeitem"})[(0,f.useContext)(iN)])?h:"option",children:t,...u,onClick:E,onKeyDown:S};let F=nJ(s);return u=ap({store:e,...u,getItem:v,moveOnKeyPress:t=>{if(!F(t))return!1;let r=new Event("combobox-item-move"),n=null==e?void 0:e.getState().baseElement;return null==n||n.dispatchEvent(r),!0}}),u=an({store:e,focusOnHover:o,...u})}),ag=n$(nZ(function(e){return n0("div",aA(e))})),av=e.i(74080);function aC(e,t){let r=setTimeout(t,e);return()=>clearTimeout(r)}function aB(...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 ay(e,t,r){return!r&&!1!==t&&(!e||!!t)}var ab=n1(function({store:e,alwaysVisible:t,...r}){let n=iw();nv(e=e||n,!1);let i=(0,f.useRef)(null),a=nU(r.id),[o,s]=(0,f.useState)(null),l=e.useState("open"),u=e.useState("mounted"),c=e.useState("animated"),h=e.useState("contentElement"),m=ac(e.disclosure,"contentElement");nH(()=>{i.current&&(null==e||e.setContentElement(i.current))},[e]),nH(()=>{let t;return null==e||e.setState("animated",e=>(t=e,!0)),()=>{void 0!==t&&(null==e||e.setState("animated",t))}},[e]),nH(()=>{if(c){var e;let t;return(null==h?void 0:h.isConnected)?(e=()=>{s(l?"enter":u?"leave":null)},t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)}),()=>cancelAnimationFrame(t)):void s(null)}},[c,h,l,u]),nH(()=>{if(!e||!c||!o||!h)return;let t=()=>null==e?void 0:e.setState("animating",!1),r=()=>(0,av.flushSync)(t);if("leave"===o&&l||"enter"===o&&!l)return;if("number"==typeof c)return aC(c,r);let{transitionDuration:n,animationDuration:i,transitionDelay:a,animationDelay:s}=getComputedStyle(h),{transitionDuration:u="0",animationDuration:d="0",transitionDelay:f="0",animationDelay:p="0"}=m?getComputedStyle(m):{},A=aB(a,s,f,p)+aB(n,i,u,d);if(!A){"enter"===o&&e.setState("animated",!1),t();return}return aC(Math.max(A-1e3/60,0),r)},[e,c,h,m,l,o]);let p=ay(u,(r=nK(r,t=>(0,d.jsx)(iL,{value:e,children:t}),[e])).hidden,t),A=r.style,g=(0,f.useMemo)(()=>p?{...A,display:"none"}:A,[p,A]);return ny(r={id:a,"data-open":l||void 0,"data-enter":"enter"===o||void 0,"data-leave":"leave"===o||void 0,hidden:p,...r,ref:nk(a?e.setContentElement:null,i,r.ref),style:g})}),ax=nZ(function(e){return n0("div",ab(e))});nZ(function({unmountOnHide:e,...t}){let r=iw();return!1===ac(t.store||r,t=>!e||(null==t?void 0:t.mounted))?null:(0,d.jsx)(ax,{...t})});var aE=n1(function({store:e,alwaysVisible:t,...r}){let n=iQ(!0),i=iK(),a=!!(e=e||i)&&e===n;nv(e,!1);let o=(0,f.useRef)(null),s=nU(r.id),l=e.useState("mounted"),u=ay(l,r.hidden,t),c=u?{...r.style,display:"none"}:r.style,h=e.useState(e=>Array.isArray(e.selectedValue)),m=function(e,t,r){let n=function(e){let[t]=(0,f.useState)(e);return t}(r),[i,a]=(0,f.useState)(n);return(0,f.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,f.useState)(!1),v=e.useState("contentElement");nH(()=>{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&&h||void 0,...r}),r=nK(r,t=>(0,d.jsx)(iX,{value:e,children:(0,d.jsx)(iN.Provider,{value:m,children:t})}),[e,m]);let C=!s||n&&a?null:e.setContentElement;return ny(r={id:s,hidden:u,...r,ref:nk(C,o,r.ref),style:c})}),aM=nZ(function(e){return n0("div",aE(e))}),aS=(0,f.createContext)(null),aF=n1(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}}});nZ(function(e){return n0("span",aF(e))});var aT=n1(function(e){return aF(e={"data-focus-trap":"",tabIndex:0,"aria-hidden":!0,...e,style:{position:"fixed",top:0,left:0,...e.style}})}),aR=nZ(function(e){return n0("span",aT(e))});function aw(e){queueMicrotask(()=>{null==e||e.focus()})}var aD=n1(function({preserveTabOrder:e,preserveTabOrderAnchor:t,portalElement:r,portalRef:n,portal:i=!0,...a}){let o=(0,f.useRef)(null),s=nk(o,a.ref),l=(0,f.useContext)(aS),[u,c]=(0,f.useState)(null),[h,m]=(0,f.useState)(null),p=(0,f.useRef)(null),A=(0,f.useRef)(null),g=(0,f.useRef)(null),v=(0,f.useRef)(null);return nH(()=>{let e=o.current;if(!e||!i)return void c(null);let t=r?"function"==typeof r?r(e):r:r6(e).createElement("div");if(!t)return void c(null);let a=t.isConnected;if(a||(l||r6(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),nx(n,t),!a)return()=>{t.remove(),nx(n,null)}},[i,r,l,n]),nH(()=>{if(!i||!e||!t)return;let r=r6(t).createElement("span");return r.style.position="fixed",t.insertAdjacentElement("afterend",r),m(r),()=>{r.remove(),m(null)}},[i,e,t]),(0,f.useEffect)(()=>{if(!u||!e)return;let t=0,r=e=>{if(!nD(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 il(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=nK(a,t=>{if(t=(0,d.jsx)(aS.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)(aR,{ref:A,"data-focus-trap":a.id,className:"__focus-trap-inner-before",onFocus:e=>{nD(e,u)?aw(iu()):aw(p.current)}}),t,e&&u&&(0,d.jsx)(aR,{ref:g,"data-focus-trap":a.id,className:"__focus-trap-inner-after",onFocus:e=>{nD(e,u)?aw(ic()):aw(v.current)}})]}),u&&(t=(0,av.createPortal)(t,u));let r=(0,d.jsxs)(d.Fragment,{children:[e&&u&&(0,d.jsx)(aR,{ref:p,"data-focus-trap":a.id,className:"__focus-trap-outer-before",onFocus:e=>{e.relatedTarget!==v.current&&nD(e,u)?aw(A.current):aw(ic())}}),e&&(0,d.jsx)("span",{"aria-owns":null==u?void 0:u.id,style:{position:"fixed"}}),e&&u&&(0,d.jsx)(aR,{ref:v,"data-focus-trap":a.id,className:"__focus-trap-outer-after",onFocus:e=>{if(nD(e,u))aw(g.current);else{let e=iu();if(e===A.current)return void requestAnimationFrame(()=>{var e;return null==(e=iu())?void 0:e.focus()});aw(e)}}})]});return h&&e&&(r=(0,av.createPortal)(r,h)),(0,d.jsxs)(d.Fragment,{children:[r,t]})},[u,l,i,a.id,e,h]),ref:s}});nZ(function(e){return n0("div",aD(e))});var aI=(0,f.createContext)(0);function aG({level:e,children:t}){let r=(0,f.useContext)(aI),n=Math.max(Math.min(e||r+1,6),1);return(0,d.jsx)(aI.Provider,{value:n,children:t})}var aL=n1(function({autoFocusOnShow:e=!0,...t}){return nK(t,t=>(0,d.jsx)(ir.Provider,{value:e,children:t}),[e])});nZ(function(e){return n0("div",aL(e))});var aO=new WeakMap;function aP(e,t,r){aO.has(e)||aO.set(e,new Map);let n=aO.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 aH(e,t,r){return aP(e,t,()=>{let n=e.getAttribute(t);return e.setAttribute(t,r),()=>{null==n?e.removeAttribute(t):e.setAttribute(t,n)}})}function a_(e,t,r){return aP(e,t,()=>{let n=t in e,i=e[t];return e[t]=r,()=>{n?e[t]=i:delete e[t]}})}function ak(e,t){return e?aP(e,"style",()=>{let r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}):()=>{}}var aU=["SCRIPT","STYLE"];function aj(e){return`__ariakit-dialog-snapshot-${e}`}function aN(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=r6(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!aU.includes(t.tagName)&&!!function(e,t){let r=r6(t),n=aj(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&&ne(t,e))})(e,n,t)&&r(n,s);i=i.parentElement}}}function aJ(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 aK(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function aQ(e,t=""){return nA(a_(e,aK("",!0),!0),a_(e,aK(t,!0),!0))}function aV(e,t){if(e[aK(t,!0)])return!0;let r=aK(t);for(;;){if(e[r])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function aq(e,t){let r=[],n=t.map(e=>null==e?void 0:e.id);return aN(e,t,t=>{aJ(t,...n)||r.unshift(function(e,t=""){return nA(a_(e,aK(),!0),a_(e,aK(t),!0))}(t,e))},(t,n)=>{n.hasAttribute("data-dialog")&&n.id!==e||r.unshift(aQ(t,e))}),()=>{for(let e of r)e()}}function aX({store:e,type:t,listener:r,capture:n,domReady:i}){let a=n_(r),o=ac(e,"open"),s=(0,f.useRef)(!1);nH(()=>{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,f.useEffect)(()=>{if(o)return nG(t,t=>{let{contentElement:r,disclosureElement:n}=e.getState(),i=t.target;!r||!i||!(!("HTML"===i.tagName||ne(r6(i).body,i))||ne(r,i)||function(e,t){if(!e)return!1;if(ne(e,t))return!0;let r=t.getAttribute("aria-activedescendant");if(r){let t=r6(e).getElementById(r);if(t)return ne(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||aV(i,r.id))&&(i&&i[ig]||a(t))},n)},[o,n])}function aW(e,t){return"function"==typeof e?e(t):!!e}var aY=(0,f.createContext)({});function az(){return"inert"in HTMLElement.prototype}function aZ(e,t){if(!("style"in e))return nm;if(az())return a_(e,"inert",!0);let r=il(e,!0).map(e=>{if(null==t?void 0:t.some(t=>t&&ne(t,e)))return nm;let r=aP(e,"focus",()=>(e.focus=nm,()=>{delete e.focus}));return nA(aH(e,"tabindex","-1"),r)});return nA(...r,aH(e,"aria-hidden","true"),ak(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}function a$(e={}){let t=i8(e.store,i3(e.disclosure,["contentElement","disclosureElement"]));i5(e,t);let r=null==t?void 0:t.getState(),n=nb(e.open,null==r?void 0:r.open,e.defaultOpen,!1),i=nb(e.animated,null==r?void 0:r.animated,!1),a=iZ({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:nb(null==r?void 0:r.contentElement,null),disclosureElement:nb(null==r?void 0:r.disclosureElement,null)},t);return i$(a,()=>i9(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),i$(a,()=>i1(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),i$(a,()=>i9(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 a0(e,t,r){return nj(t,[r.store,r.disclosure]),af(e,r,"open","setOpen"),af(e,r,"mounted","setMounted"),af(e,r,"animated"),Object.assign(e,{disclosure:r.disclosure})}n1(function(e){return e});var a1=nZ(function(e){return n0("div",e)});function a9({store:e,backdrop:t,alwaysVisible:r,hidden:n}){let i=(0,f.useRef)(null),a=function(e={}){let[t,r]=ah(a$,e);return a0(t,r,e)}({disclosure:e}),o=ac(e,"contentElement");(0,f.useEffect)(()=>{let e=i.current;!e||o&&(e.style.zIndex=getComputedStyle(o).zIndex)},[o]),nH(()=>{let e=null==o?void 0:o.id;if(!e)return;let t=i.current;if(t)return aQ(t,e)},[o]);let s=ab({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,f.isValidElement)(t))return(0,d.jsx)(a1,{...s,render:t});let l="boolean"!=typeof t?t:"div";return(0,d.jsx)(a1,{...s,render:(0,d.jsx)(l,{})})}function a2(e={}){return a$(e)}Object.assign(a1,["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]=nZ(function(e){return n0(t,e)}),e),{}));var a3=nS();function a8(e,t=!1){if(!e)return null;let r="current"in e?e.current:e;return r?t?ia(r)?r:null:r:null}var a5=n1(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:h=!0,autoFocusOnHide:m=!0,initialFocus:p,finalFocus:A,unmountOnHide:g,unstable_treeSnapshotKey:v,...C}){var B;let y,b,x,E=iI(),M=(0,f.useRef)(null),S=function(e={}){let[t,r]=ah(a2,e);return a0(t,r,e)}({store:e||E,open:t,setOpen(e){if(e)return;let t=M.current;if(!t)return;let n=new Event("close",{bubbles:!1,cancelable:!0});r&&t.addEventListener("close",r,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&S.setOpen(!0)}}),{portalRef:F,domReady:T}=nQ(a,C.portalRef),R=C.preserveTabOrder,w=ac(S,e=>R&&!i&&e.mounted),D=nU(C.id),I=ac(S,"open"),G=ac(S,"mounted"),L=ac(S,"contentElement"),O=ay(G,C.hidden,C.alwaysVisible);y=function({attribute:e,contentId:t,contentElement:r,enabled:n}){let[i,a]=nN(),o=(0,f.useCallback)(()=>{if(!n||!r)return!1;let{body:i}=r6(r),a=i.getAttribute(e);return!a||a===t},[i,n,r,e,t]);return(0,f.useEffect)(()=>{if(!n||!t||!r)return;let{body:i}=r6(r);if(o())return i.setAttribute(e,t),()=>i.removeAttribute(e);let s=new MutationObserver(()=>(0,av.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,f.useEffect)(()=>{var e,t;if(!y()||!L)return;let r=r6(L),n=r4(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=nM()&&!(r5&&navigator.platform.startsWith("Mac")&&!nE());return nA((e="--scrollbar-width",t=`${s}px`,i?aP(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=ak(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"})}})():ak(a,{overflow:"hidden",[l]:`${s}px`}))},[y,L]),B=ac(S,"open"),b=(0,f.useRef)(),(0,f.useEffect)(()=>{if(!B){b.current=null;return}return nG("mousedown",e=>{b.current=e.target},!0)},[B]),aX({...x={store:S,domReady:T,capture:!0},type:"click",listener:e=>{let{contentElement:t}=S.getState(),r=b.current;r&&ni(r)&&aV(r,null==t?void 0:t.id)&&aW(l,e)&&S.hide()}}),aX({...x,type:"focusin",listener:e=>{let{contentElement:t}=S.getState();!t||e.target===r6(t)||aW(l,e)&&S.hide()}}),aX({...x,type:"contextmenu",listener:e=>{aW(l,e)&&S.hide()}});let{wrapElement:P,nestedDialogs:H}=function(e){let t=(0,f.useContext)(aY),[r,n]=(0,f.useState)([]),i=(0,f.useCallback)(e=>{var r;return n(t=>[...t,e]),nA(null==(r=t.add)?void 0:r.call(t,e),()=>{n(t=>t.filter(t=>t!==e))})},[t]);nH(()=>i9(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,f.useMemo)(()=>({store:e,add:i}),[e,i]);return{wrapElement:(0,f.useCallback)(e=>(0,d.jsx)(aY.Provider,{value:a,children:e}),[a]),nestedDialogs:r}}(S);C=nK(C,P,[P]),nH(()=>{if(!I)return;let e=M.current,t=r7(e,!0);!t||"BODY"===t.tagName||e&&ne(e,t)||S.setDisclosureElement(t)},[S,I]),a3&&(0,f.useEffect)(()=>{if(!G)return;let{disclosureElement:e}=S.getState();if(!e||!nr(e))return;let t=()=>{let t=!1,r=()=>{t=!0};e.addEventListener("focusin",r,{capture:!0,once:!0}),nI(e,"mouseup",()=>{e.removeEventListener("focusin",r,!0),t||im(e)})};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}},[S,G]),(0,f.useEffect)(()=>{if(!G||!T)return;let e=M.current;if(!e)return;let t=r4(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,f.useEffect)(()=>{if(!i||!G||!T)return;let e=M.current;if(e&&!e.querySelector("[data-dialog-dismiss]")){var t;let r;return t=S.hide,(r=r6(e).createElement("button")).type="button",r.tabIndex=-1,r.textContent="Dismiss popup",Object.assign(r.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),r.addEventListener("click",t),e.prepend(r),()=>{r.removeEventListener("click",t),r.remove()}}},[S,i,G,T]),nH(()=>{if(!az()||I||!G||!T)return;let e=M.current;if(e)return aZ(e)},[I,G,T]);let _=I&&T;nH(()=>{if(D&&_)return function(e,t){let{body:r}=r6(t[0]),n=[];return aN(e,t,t=>{n.push(a_(t,aj(e),!0))}),nA(a_(r,aj(e),!0),()=>{for(let e of n)e()})}(D,[M.current])},[D,_,v]);let k=n_(u);nH(()=>{if(!D||!_)return;let{disclosureElement:e}=S.getState(),t=[M.current,...k()||[],...H.map(e=>e.getState().contentElement)];if(i){let e,r;return nA(aq(D,t),(e=[],r=t.map(e=>null==e?void 0:e.id),aN(D,t,n=>{aJ(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(aZ(n,t))},r=>{!r.hasAttribute("role")||t.some(e=>e&&ne(e,r))||e.unshift(aH(r,"role","none"))}),()=>{for(let t of e)t()}))}return aq(D,[e,...t])},[D,S,_,k,H,i,v]);let U=!!h,j=nJ(h),[N,J]=(0,f.useState)(!1);(0,f.useEffect)(()=>{if(!I||!U||!T||!(null==L?void 0:L.isConnected))return;let e=a8(p,!0)||L.querySelector("[data-autofocus=true],[autofocus]")||function(e,t,r){let[n]=il(e,t,r);return n||null}(L,!0,a&&w)||L,t=ia(e);j(t?e:null)&&(J(!0),queueMicrotask(()=>{e.focus(),!a3||t&&e.scrollIntoView({block:"nearest",inline:"nearest"})}))},[I,U,T,L,p,a,w,j]);let K=!!m,Q=nJ(m),[V,q]=(0,f.useState)(!1);(0,f.useEffect)(()=>{if(I)return q(!0),()=>q(!1)},[I]);let X=(0,f.useCallback)((e,t=!0)=>{let r,{disclosureElement:n}=S.getState();if(!(!(r=r7())||e&&ne(e,r))&&ia(r))return;let i=a8(A)||n;if(null==i?void 0:i.id){let e=r6(i),t=`[aria-activedescendant="${i.id}"]`,r=e.querySelector(t);r&&(i=r)}if(i&&!ia(i)){let e=i.closest("[data-dialog]");if(null==e?void 0:e.id){let t=r6(e),r=`[aria-controls~="${e.id}"]`,n=t.querySelector(r);n&&(i=n)}}let a=i&&ia(i);!a&&t?requestAnimationFrame(()=>X(e,!1)):!Q(a?i:null)||a&&(null==i||i.focus({preventScroll:!0}))},[S,A,Q]),W=(0,f.useRef)(!1);nH(()=>{if(I||!V||!K)return;let e=M.current;W.current=!0,X(e)},[I,V,T,K,X]),(0,f.useEffect)(()=>{if(!V||!K)return;let e=M.current;return()=>{if(W.current){W.current=!1;return}X(e)}},[V,K,X]);let Y=nJ(s);(0,f.useEffect)(()=>{if(T&&G)return nG("keydown",e=>{if("Escape"!==e.key||e.defaultPrevented)return;let t=M.current;if(!t||aV(t))return;let r=e.target;if(!r)return;let{disclosureElement:n}=S.getState();!("BODY"===r.tagName||ne(t,r)||!n||ne(n,r))||Y(e)&&S.hide()},!0)},[S,T,G,Y]);let z=(C=nK(C,e=>(0,d.jsx)(aG,{level:i?1:void 0,children:e}),[i])).hidden,Z=C.alwaysVisible;C=nK(C,e=>o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a9,{store:S,backdrop:o,hidden:z,alwaysVisible:Z}),e]}):e,[S,o,z,Z]);let[$,ee]=(0,f.useState)(),[et,er]=(0,f.useState)();return C=aL({...C={id:D,"data-dialog":"",role:"dialog",tabIndex:n?-1:void 0,"aria-labelledby":$,"aria-describedby":et,...C=nK(C,e=>(0,d.jsx)(iL,{value:S,children:(0,d.jsx)(iO.Provider,{value:ee,children:(0,d.jsx)(iP.Provider,{value:er,children:e})})}),[S]),ref:nk(M,C.ref)},autoFocusOnShow:N}),C=aD({portal:a,...C=iE({...C=ab({store:S,...C}),focusable:n}),portalRef:F,preserveTabOrder:w})});function a6(e,t=iI){return nZ(function(r){let n=t();return ac(r.store||n,e=>!r.unmountOnHide||(null==e?void 0:e.mounted)||!!r.open)?(0,d.jsx)(e,{...r}):null})}a6(nZ(function(e){return n0("div",a5(e))}),iI);let a4=Math.min,a7=Math.max,oe=Math.round,ot=Math.floor,or=e=>({x:e,y:e}),on={left:"right",right:"left",bottom:"top",top:"bottom"},oi={start:"end",end:"start"};function oa(e,t){return"function"==typeof e?e(t):e}function oo(e){return e.split("-")[0]}function os(e){return e.split("-")[1]}function ol(e){return"x"===e?"y":"x"}function ou(e){return"y"===e?"height":"width"}let oc=new Set(["top","bottom"]);function od(e){return oc.has(oo(e))?"y":"x"}function of(e){return e.replace(/start|end/g,e=>oi[e])}let oh=["left","right"],om=["right","left"],op=["top","bottom"],oA=["bottom","top"];function og(e){return e.replace(/left|right|bottom|top/g,e=>on[e])}function ov(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function oC(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function oB(e,t,r){let n,{reference:i,floating:a}=e,o=od(t),s=ol(od(t)),l=ou(s),u=oo(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(os(t)){case"start":n[s]-=h*(r&&c?-1:1);break;case"end":n[s]+=h*(r&&c?-1:1)}return n}let oy=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}=oB(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}=oB(u,f,l)),r=-1)}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function ob(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}=oa(t,e),m=ov(h),p=s[f?"floating"===d?"reference":"floating":d],A=oC(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=oC(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 ox=new Set(["left","top"]);async function oE(e,t){let{placement:r,platform:n,elements:i}=e,a=await (null==n.isRTL?void 0:n.isRTL(i.floating)),o=oo(r),s=os(r),l="y"===od(r),u=ox.has(o)?-1:1,c=a&&l?-1:1,d=oa(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 oM(){return"undefined"!=typeof window}function oS(e){return oR(e)?(e.nodeName||"").toLowerCase():"#document"}function oF(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function oT(e){var t;return null==(t=(oR(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function oR(e){return!!oM()&&(e instanceof Node||e instanceof oF(e).Node)}function ow(e){return!!oM()&&(e instanceof Element||e instanceof oF(e).Element)}function oD(e){return!!oM()&&(e instanceof HTMLElement||e instanceof oF(e).HTMLElement)}function oI(e){return!!oM()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof oF(e).ShadowRoot)}let oG=new Set(["inline","contents"]);function oL(e){let{overflow:t,overflowX:r,overflowY:n,display:i}=oQ(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!oG.has(i)}let oO=new Set(["table","td","th"]),oP=[":popover-open",":modal"];function oH(e){return oP.some(t=>{try{return e.matches(t)}catch(e){return!1}})}let o_=["transform","translate","scale","rotate","perspective"],ok=["transform","translate","scale","rotate","perspective","filter"],oU=["paint","layout","strict","content"];function oj(e){let t=oN(),r=ow(e)?oQ(e):e;return o_.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||ok.some(e=>(r.willChange||"").includes(e))||oU.some(e=>(r.contain||"").includes(e))}function oN(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}let oJ=new Set(["html","body","#document"]);function oK(e){return oJ.has(oS(e))}function oQ(e){return oF(e).getComputedStyle(e)}function oV(e){return ow(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function oq(e){if("html"===oS(e))return e;let t=e.assignedSlot||e.parentNode||oI(e)&&e.host||oT(e);return oI(t)?t.host:t}function oX(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=oq(t);return oK(r)?t.ownerDocument?t.ownerDocument.body:t.body:oD(r)&&oL(r)?r:e(r)}(e),a=i===(null==(n=e.ownerDocument)?void 0:n.body),o=oF(i);if(a){let e=oW(o);return t.concat(o,o.visualViewport||[],oL(i)?i:[],e&&r?oX(e):[])}return t.concat(i,oX(i,[],r))}function oW(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oY(e){let t=oQ(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=oD(e),a=i?e.offsetWidth:r,o=i?e.offsetHeight:n,s=oe(r)!==a||oe(n)!==o;return s&&(r=a,n=o),{width:r,height:n,$:s}}function oz(e){return ow(e)?e:e.contextElement}function oZ(e){let t=oz(e);if(!oD(t))return or(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:a}=oY(t),o=(a?oe(r.width):r.width)/n,s=(a?oe(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}let o$=or(0);function o0(e){let t=oF(e);return oN()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:o$}function o1(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let a=e.getBoundingClientRect(),o=oz(e),s=or(1);t&&(n?ow(n)&&(s=oZ(n)):s=oZ(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===oF(o))&&i)?o0(o):or(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=oF(o),t=n&&ow(n)?oF(n):n,r=e,i=oW(r);for(;i&&n&&t!==r;){let e=oZ(i),t=i.getBoundingClientRect(),n=oQ(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=oW(r=oF(i))}}return oC({width:d,height:f,x:u,y:c})}function o9(e,t){let r=oV(e).scrollLeft;return t?t.left+r:o1(oT(e)).left+r}function o2(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-o9(e,r),y:r.top+t.scrollTop}}let o3=new Set(["absolute","fixed"]);function o8(e,t,r){var n;let i;if("viewport"===t)i=function(e,t){let r=oF(e),n=oT(e),i=r.visualViewport,a=n.clientWidth,o=n.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;let e=oN();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}let u=o9(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=oT(e),t=oT(n),r=oV(n),a=n.ownerDocument.body,o=a7(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=a7(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),l=-r.scrollLeft+o9(n),u=-r.scrollTop,"rtl"===oQ(a).direction&&(l+=a7(t.clientWidth,a.clientWidth)-o),i={width:o,height:s,x:l,y:u}}else if(ow(t)){let e,n,a,o,s,l;n=(e=o1(t,!0,"fixed"===r)).top+t.clientTop,a=e.left+t.clientLeft,o=oD(t)?oZ(t):or(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=o0(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return oC(i)}function o5(e){return"static"===oQ(e).position}function o6(e,t){if(!oD(e)||"fixed"===oQ(e).position)return null;if(t)return t(e);let r=e.offsetParent;return oT(e)===r&&(r=r.ownerDocument.body),r}function o4(e,t){var r;let n=oF(e);if(oH(e))return n;if(!oD(e)){let t=oq(e);for(;t&&!oK(t);){if(ow(t)&&!o5(t))return t;t=oq(t)}return n}let i=o6(e,t);for(;i&&(r=i,oO.has(oS(r)))&&o5(i);)i=o6(i,t);return i&&oK(i)&&o5(i)&&!oj(i)?n:i||function(e){let t=oq(e);for(;oD(t)&&!oK(t);){if(oj(t))return t;if(oH(t))break;t=oq(t)}return null}(e)||n}let o7=async function(e){let t=this.getOffsetParent||o4,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=oD(t),i=oT(t),a="fixed"===r,o=o1(e,!0,a,t),s={scrollLeft:0,scrollTop:0},l=or(0);if(n||!n&&!a)if(("body"!==oS(t)||oL(i))&&(s=oV(t)),n){let e=o1(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=o9(i));a&&!n&&i&&(l.x=o9(i));let u=!i||n||a?or(0):o2(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}}},se={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,a="fixed"===i,o=oT(n),s=!!t&&oH(t.floating);if(n===o||s&&a)return r;let l={scrollLeft:0,scrollTop:0},u=or(1),c=or(0),d=oD(n);if((d||!d&&!a)&&(("body"!==oS(n)||oL(o))&&(l=oV(n)),oD(n))){let e=o1(n);u=oZ(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let f=!o||d||a?or(0):o2(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:oT,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?oH(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=oX(e,[],!1).filter(e=>ow(e)&&"body"!==oS(e)),i=null,a="fixed"===oQ(e).position,o=a?oq(e):e;for(;ow(o)&&!oK(o);){let t=oQ(o),r=oj(o);r||"fixed"!==t.position||(i=null),(a?!r&&!i:!r&&"static"===t.position&&!!i&&o3.has(i.position)||oL(o)&&!r&&function e(t,r){let n=oq(t);return!(n===r||!ow(n)||oK(n))&&("fixed"===oQ(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=oq(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],o=a[0],s=a.reduce((e,r)=>{let n=o8(t,r,i);return e.top=a7(n.top,e.top),e.right=a4(n.right,e.right),e.bottom=a4(n.bottom,e.bottom),e.left=a7(n.left,e.left),e},o8(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:o4,getElementRects:o7,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=oY(e);return{width:t,height:r}},getScale:oZ,isElement:ow,isRTL:function(e){return"rtl"===oQ(e).direction}};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sr(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 sn(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function si(e){let t=window.devicePixelRatio||1;return Math.round(e*t)/t}var sa=n1(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:h=!1,fitViewport:m=!1,gutter:p,arrowPadding:A=4,overflowPadding:g=8,getAnchorRect:v,updatePosition:C,...B}){let y=i_();nv(e=e||y,!1);let b=e.useState("arrowElement"),x=e.useState("anchorElement"),E=e.useState("disclosureElement"),M=e.useState("popoverElement"),S=e.useState("contentElement"),F=e.useState("placement"),T=e.useState("mounted"),R=e.useState("rendered"),w=(0,f.useRef)(null),[D,I]=(0,f.useState)(!1),{portalRef:G,domReady:L}=nQ(r,B.portalRef),O=n_(v),P=n_(C),H=!!C;nH(()=>{if(!(null==M?void 0:M.isConnected))return;M.style.setProperty("--popover-overflow-padding",`${g}px`);let t={contextElement:x||void 0,getBoundingClientRect:()=>{let e=null==O?void 0:O(x);return e||!x?function(e){if(!e)return sr();let{x:t,y:r,width:n,height:i}=e;return sr(t,r,n,i)}(e):x.getBoundingClientRect()}},r=async()=>{var r,n,i,a,d;let f,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 oE(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 nv(!r||r.every(sn),!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,...M}=oa(t,e);if(null!=(r=m.arrow)&&r.alignmentOffset)return{};let S=oo(h),F=od(A),T=oo(A)===A,R=await (null==g.isRTL?void 0:g.isRTL(v.floating)),w=y||(T||!E?[og(A)]:(c=og(A),[of(A),c,of(c)])),D="none"!==x;!y&&D&&w.push(...(d=os(A),f=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?om:oh;return t?oh:om;case"left":case"right":return t?op:oA;default:return[]}}(oo(A),"start"===x,R),d&&(f=f.map(e=>e+"-"+d),E&&(f=f.concat(f.map(of)))),f));let I=[A,...w],G=await ob(e,M),L=[],O=(null==(n=m.flip)?void 0:n.overflows)||[];if(C&&L.push(G[S]),B){let e,t,r,n,i=(s=h,l=p,void 0===(u=R)&&(u=!1),e=os(s),r=ou(t=ol(od(s))),n="x"===t?e===(u?"end":"start")?"right":"left":"start"===e?"bottom":"top",l.reference[r]>l.floating[r]&&(n=og(n)),[n,og(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||F===od(t)||O.every(e=>od(e.placement)!==F||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=od(e.placement);return t===F||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=A}if(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}=oa(t,e),c={x:r,y:n},d=od(i),f=ol(d),h=c[f],m=c[d],p=oa(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=ox.has(oo(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}=oa(r,e),u={x:t,y:n},c=await ob(e,l),d=od(oo(i)),f=ol(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=a7(r,a4(h,n))}if(o){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=m+c[e],n=m-c[t];m=a7(r,a4(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}=oa(r,e)||{};if(null==u)return{};let d=ov(c),f={x:t,y:n},h=ol(od(i)),m=ou(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=a4(d[A?"top":"left"],b),E=a4(d[A?"bottom":"right"],b),M=y-p[m]-E,S=y/2-p[m]/2+(v/2-C/2),F=a7(x,a4(S,M)),T=!l.arrow&&null!=os(i)&&S!==F&&a.reference[m]/2-(S<x?x:E)-p[m]/2<0,R=T?S<x?S-x:S-M:0;return{[h]:f[h]+R,data:{[h]:F,centerOffset:S-F-R,...T&&{alignmentOffset:R}},reset:T}}}}}(B,{arrowPadding:A}),{name:"size",options:a={padding:(i={sameWidth:h,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}=oa(a,e),f=await ob(e,d),h=oo(o),m=os(o),p="y"===od(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=a4(g-f[n],v),y=a4(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=a7(f.left,0),t=a7(f.right,0),r=a7(f.top,0),n=a7(f.bottom,0);p?E=A-2*(0!==e||0!==t?e+t:a7(f.left,f.right)):x=g-2*(0!==r||0!==n?r+n:a7(f.top,f.bottom))}await c({...e,availableWidth:E,availableHeight:x});let M=await l.getDimensions(u.floating);return A!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}],x=await (d={placement:F,strategy:o?"fixed":"absolute",middleware:y},f=new Map,C={...(v={platform:se,...d}).platform,_c:f},oy(t,M,{...v,platform:C}));null==e||e.setState("currentPlacement",x.placement),I(!0);let E=si(x.x),S=si(x.y);if(Object.assign(M.style,{top:"0",left:"0",transform:`translate3d(${E}px,${S}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;M.style.setProperty("--popover-transform-origin",{top:`${a}px calc(100% + ${i}px)`,bottom:`${a}px ${-i}px`,left:`calc(100% + ${n}px) ${o}px`,right:`${-n}px ${o}px`}[r]),Object.assign(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=oz(e),d=a||o?[...c?oX(c):[],...oX(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=oT(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:-ot(d)+"px "+-ot(i.clientWidth-(c+f))+"px "+-ot(i.clientHeight-(d+h))+"px "+-ot(c)+"px",threshold:a7(0,a4(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||st(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?o1(e):null;return u&&function t(){let n=o1(e);p&&!st(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,M,async()=>{H?(await P({updatePosition:r}),I(!0)):await r()},{elementResize:"function"==typeof ResizeObserver});return()=>{I(!1),n()}},[e,R,M,b,x,M,F,T,L,o,s,l,u,c,h,m,p,A,g,O,H,P]),nH(()=>{if(!T||!L||!(null==M?void 0:M.isConnected)||!(null==S?void 0:S.isConnected))return;let e=()=>{M.style.zIndex=getComputedStyle(S).zIndex};e();let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)},[T,L,M,S]);let _=o?"fixed":"absolute";return B=nK(B,t=>(0,d.jsx)("div",{...a,style:{position:_,top:0,left:0,width:"max-content",...null==a?void 0:a.style},ref:null==e?void 0:e.setPopoverElement,children:t}),[e,_,a]),B={"data-placing":!D||void 0,...B=nK(B,t=>(0,d.jsx)(iU,{value:e,children:t}),[e]),style:{position:"relative",...B.style}},B=a5({store:e,modal:t,portal:r,preserveTabOrder:n,preserveTabOrderAnchor:E||x,autoFocusOnShow:D&&i,...B,portalRef:G})});a6(nZ(function(e){return n0("div",sa(e))}),i_);var so=n1(function({store:e,modal:t,tabIndex:r,alwaysVisible:n,autoFocusOnHide:i=!0,hideOnInteractOutside:a=!0,...o}){let s=iV();nv(e=e||s,!1);let l=e.useState("baseElement"),u=(0,f.useRef)(!1),c=ac(e.tag,e=>null==e?void 0:e.renderedItems.length);return o=aE({store:e,alwaysVisible:n,...o}),o=sa({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=r6(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=>!nC(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}})}),ss=a6(nZ(function(e){return n0("div",so(e))}),iV);(0,f.createContext)(null),(0,f.createContext)(null);var sl=n9([n4],[n7]),su=sl.useContext;sl.useScopedContext,sl.useProviderContext,sl.ContextProvider,sl.ScopedContextProvider;var sc={id:null};function sd(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function sf(e,t){return e.filter(e=>e.rowId===t)}function sh(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 sm(e){let t=0;for(let{length:r}of e)r>t&&(t=r);return t}var sp=nS()&&nE();function sA({tag:e,...t}={}){let r=i8(t.store,function(e,...t){if(e)return iz(e,"pick")(...t)}(e,["value","rtl"]));i5(t,r);let n=null==e?void 0:e.getState(),i=null==r?void 0:r.getState(),a=nb(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;i5(e,e.store);let n=null==(t=e.store)?void 0:t.getState(),i=nb(e.items,null==n?void 0:n.items,e.defaultItems,[]),a=new Map(i.map(e=>[e.id,e])),o={items:i,renderedItems:nb(null==n?void 0:n.renderedItems,[])},s=null==(r=e.store)?void 0:r.__unstablePrivateStore,l=iZ({items:i,renderedItems:o.renderedItems},s),u=iZ(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)};i$(u,()=>i0(l)),i$(l,()=>i2(l,["items"],e=>{u.setState("items",e.items)})),i$(l,()=>i2(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 r6(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=>nA(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=nb(e.activeId,null==r?void 0:r.activeId,e.defaultActiveId),a=iZ({...n.getState(),id:nb(e.id,null==r?void 0:r.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:nb(null==r?void 0:r.baseElement,null),includesBaseElement:nb(e.includesBaseElement,null==r?void 0:r.includesBaseElement,null===i),moves:nb(null==r?void 0:r.moves,0),orientation:nb(e.orientation,null==r?void 0:r.orientation,"both"),rtl:nb(e.rtl,null==r?void 0:r.rtl,!1),virtualFocus:nb(e.virtualFocus,null==r?void 0:r.virtualFocus,!1),focusLoop:nb(e.focusLoop,null==r?void 0:r.focusLoop,!1),focusWrap:nb(e.focusWrap,null==r?void 0:r.focusWrap,!1),focusShift:nb(e.focusShift,null==r?void 0:r.focusShift,!1)},n,e.store);i$(a,()=>i9(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var r;return void 0!==t?t:null==(r=sd(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?iM(function(e,t,r){let n=sm(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?sd(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}(sh(f),s,l&&!o)):f;if(A=(p?h&&!m:!h||m)?iS(A):A,A=m?function(e){let t=sh(e),r=sm(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=sd(A))?void 0:r.id;let g=A.find(e=>e.id===s);if(!g)return null==(n=sd(A))?void 0:n.id;let v=A.some(e=>e.rowId),C=A.indexOf(g),B=A.slice(C+1),y=sf(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=sd(function(e,t,r=!1){let n=e.findIndex(e=>e.id===t);return[...e.slice(n+1),...r?[sc]:[],...e.slice(0,n)]}(x&&!E?A:sf(A,g.rowId),s,E),s);return null==e?void 0:e.id}if(x){let e=sd(E?y:B,s);return E?(null==e?void 0:e.id)||null:null==e?void 0:e.id}let M=sd(y,s);return!M&&E?null:null==M?void 0:M.id};return{...n,...a,setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=sd(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=sd(iS(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:nb(t.includesBaseElement,null==i?void 0:i.includesBaseElement,!0),orientation:nb(t.orientation,null==i?void 0:i.orientation,"vertical"),focusLoop:nb(t.focusLoop,null==i?void 0:i.focusLoop,!0),focusWrap:nb(t.focusWrap,null==i?void 0:i.focusWrap,!0),virtualFocus:nb(t.virtualFocus,null==i?void 0:i.virtualFocus,!0)}),s=function({popover:e,...t}={}){let r=i8(t.store,i3(e,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"]));i5(t,r);let n=null==r?void 0:r.getState(),i=a2({...t,store:r}),a=nb(t.placement,null==n?void 0:n.placement,"bottom"),o=iZ({...i.getState(),placement:a,currentPlacement:a,anchorElement:nb(null==n?void 0:n.anchorElement,null),popoverElement:nb(null==n?void 0:n.popoverElement,null),arrowElement:nb(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:nb(t.placement,null==i?void 0:i.placement,"bottom-start")}),l=nb(t.value,null==i?void 0:i.value,t.defaultValue,""),u=nb(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:nb(t.resetValueOnSelect,null==i?void 0:i.resetValueOnSelect,c),resetValueOnHide:nb(t.resetValueOnHide,null==i?void 0:i.resetValueOnHide,c&&!e),activeValue:null==i?void 0:i.activeValue},f=iZ(d,o,s,r);return sp&&i$(f,()=>i9(f,["virtualFocus"],()=>{f.setState("virtualFocus",!1)})),i$(f,()=>{if(e)return nA(i9(f,["selectedValue"],t=>{Array.isArray(t.selectedValue)&&e.setValues(t.selectedValue)}),i9(e,["values"],e=>{f.setState("selectedValue",e.values)}))}),i$(f,()=>i9(f,["resetValueOnHide","mounted"],e=>{!e.resetValueOnHide||e.mounted||f.setState("value",l)})),i$(f,()=>i9(f,["open"],e=>{e.open||(f.setState("activeId",a),f.setState("moves",0))})),i$(f,()=>i9(f,["moves","activeId"],(e,t)=>{e.moves===t.moves&&f.setState("activeValue",void 0)})),i$(f,()=>i2(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 sg(e={}){var t,r,n,i,a,o,s,l;let u;t=e,u=su();let[c,d]=ah(sA,e={id:nU((r=t={...t,tag:void 0!==t.tag?t.tag:u}).id),...r});return nj(d,[(n=e).tag]),af(c,n,"value","setValue"),af(c,n,"selectedValue","setSelectedValue"),af(c,n,"resetValueOnHide"),af(c,n,"resetValueOnSelect"),Object.assign((o=c,nj(s=d,[(l=n).popover]),af(o,l,"placement"),i=a0(o,s,l),a=i,nj(d,[n.store]),af(a,n,"items","setItems"),af(i=a,n,"activeId","setActiveId"),af(i,n,"includesBaseElement"),af(i,n,"virtualFocus"),af(i,n,"orientation"),af(i,n,"rtl"),af(i,n,"focusLoop"),af(i,n,"focusWrap"),af(i,n,"focusShift"),i),{tag:n.tag})}function sv(e={}){let t=sg(e);return(0,d.jsx)(iq,{value:t,children:e.children})}var sC=(0,f.createContext)(void 0),sB=n1(function(e){let[t,r]=(0,f.useState)();return ny(e={role:"group","aria-labelledby":t,...e=nK(e,e=>(0,d.jsx)(sC.Provider,{value:r,children:e}),[])})});nZ(function(e){return n0("div",sB(e))});var sy=n1(function({store:e,...t}){return sB(t)});nZ(function(e){return n0("div",sy(e))});var sb=n1(function({store:e,...t}){let r=iQ();return nv(e=e||r,!1),"grid"===nl(e.useState("contentElement"))&&(t={role:"rowgroup",...t}),t=sy({store:e,...t})}),sx=nZ(function(e){return n0("div",sb(e))}),sE=n1(function(e){let t=(0,f.useContext)(sC),r=nU(e.id);return nH(()=>(null==t||t(r),()=>null==t?void 0:t(void 0)),[t,r]),ny(e={id:r,"aria-hidden":!0,...e})});nZ(function(e){return n0("div",sE(e))});var sM=n1(function({store:e,...t}){return sE(t)});nZ(function(e){return n0("div",sM(e))});var sS=n1(function(e){return sM(e)}),sF=nZ(function(e){return n0("div",sS(e))}),sT=e.i(38360);let sR={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},sw=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue));function sD(e,t,r={}){let{keys:n,threshold:i=sR.MATCHES,baseSort:a=sw,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)?sL:{...sL,...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=sI(i,u,c),l=t,{minRanking:d,maxRanking:f,threshold:h}=a;return s<d&&s>=sR.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:sR.NO_MATCH,keyIndex:-1,keyThreshold:c.threshold}):{rankedValue:s,rank:sI(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 sI(e,t,r){if(e=sG(e,r),(t=sG(t,r)).length>e.length)return sR.NO_MATCH;if(e===t)return sR.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 sR.EQUAL;if(0===a)return sR.STARTS_WITH;let o=i;for(;!o.done;){if(o.value>0&&" "===e[o.value-1])return sR.WORD_STARTS_WITH;o=n.next()}return a>0?sR.CONTAINS:1===t.length?sR.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)?sR.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 sR.NO_MATCH;a=s;for(let r=1,n=t.length;r<n;r++)if(!((a=o(t[r],e,a))>-1))return sR.NO_MATCH;return r=a-s,n=i/t.length,sR.MATCHES+1/r*n}(e,t)}function sG(e,{keepDiacritics:t}){return e=`${e}`,t||(e=(0,sT.default)(e)),e}sD.rankings=sR;let sL={maxRanking:1/0,minRanking:-1/0};var sO=e.i(29402);let sP=new Set(["SkiFree","SkiFree_Daily","SkiFree_Randomizer"]),sH={"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)"},s_={"z_mappacks/DM":"DM","z_mappacks/LCTF":"LCTF","z_mappacks/Lak":"LakRabbit"},sk=(0,rR.getMissionList)().filter(e=>!sP.has(e)).map(e=>{let t,r=(0,rR.getMissionInfo)(e),[n]=(0,rR.getSourceAndPath)(r.resourcePath),i=(t=n.match(/^(.*)(\/[^/]+)$/))?t[1]:"",a=sH[n]??s_[i]??null;return{resourcePath:r.resourcePath,missionName:e,displayName:r.displayName,sourcePath:n,groupName:a,missionTypes:r.missionTypes}}),sU=new Map(sk.map(e=>[e.missionName,e])),sj=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,sO.default)(e,[e=>(e.displayName||e.missionName).toLowerCase()],["asc"]))}),(0,sO.default)(Array.from(t.entries()),[([e])=>"Official"===e?0:null==e?2:1,([e])=>e?e.toLowerCase():""],["asc","asc"])}(sk),sN="undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function sJ({mission:e}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"MissionSelect-itemHeader",children:[(0,d.jsx)("span",{className:"MissionSelect-itemName",children:e.displayName||e.missionName}),e.missionTypes.length>0&&(0,d.jsx)("span",{className:"MissionSelect-itemTypes",children:e.missionTypes.map(e=>(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":e,children:e},e))})]}),(0,d.jsx)("span",{className:"MissionSelect-itemMissionName",children:e.missionName})]})}function sK({value:e,missionType:t,onChange:r}){let[n,i]=(0,f.useState)(""),a=(0,f.useRef)(null),o=(0,f.useRef)(t),s=sg({resetValueOnHide:!0,selectedValue:e,setSelectedValue:e=>{if(e){let t=o.current,n=(0,rR.getMissionInfo)(e).missionTypes;t&&n.includes(t)||(t=n[0]),r({missionName:e,missionType:t})}},setValue:e=>{(0,f.startTransition)(()=>i(e))}});(0,f.useEffect)(()=>{let e=e=>{"k"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a.current?.focus(),s.show())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]);let l=sU.get(e),u=(0,f.useMemo)(()=>n?{type:"flat",missions:sD(sk,n,{keys:["displayName","missionName","missionTypes","groupName"]})}:{type:"grouped",groups:sj},[n]),c=l?l.displayName||l.missionName:e,h="flat"===u.type?0===u.missions.length:0===u.groups.length,m=t=>(0,d.jsx)(ag,{value:t.missionName,className:"MissionSelect-item",focusOnHover:!0,onClick:n=>{if(n.target&&n.target instanceof HTMLElement){let i=n.target.dataset.missionType;i?(o.current=i,t.missionName===e&&r({missionName:t.missionName,missionType:i})):o.current=null}else o.current=null},children:(0,d.jsx)(sJ,{mission:t})},t.missionName);return(0,d.jsxs)(sv,{store:s,children:[(0,d.jsxs)("div",{className:"MissionSelect-inputWrapper",children:[(0,d.jsx)(ae,{ref:a,autoSelect:!0,placeholder:c,className:"MissionSelect-input",onFocus:()=>{document.exitPointerLock(),s.show()}}),(0,d.jsxs)("div",{className:"MissionSelect-selectedValue",children:[(0,d.jsx)("span",{className:"MissionSelect-selectedName",children:c}),t&&(0,d.jsx)("span",{className:"MissionSelect-itemType","data-mission-type":t,children:t})]}),(0,d.jsx)("kbd",{className:"MissionSelect-shortcut",children:sN?"⌘K":"^K"})]}),(0,d.jsx)(ss,{gutter:4,fitViewport:!0,className:"MissionSelect-popover",children:(0,d.jsxs)(aM,{className:"MissionSelect-list",children:["flat"===u.type?u.missions.map(m):u.groups.map(([e,t])=>e?(0,d.jsxs)(sx,{className:"MissionSelect-group",children:[(0,d.jsx)(sF,{className:"MissionSelect-groupLabel",children:e}),t.map(m)]},e):(0,d.jsx)(f.Fragment,{children:t.map(m)},"ungrouped")),h&&(0,d.jsx)("div",{className:"MissionSelect-noResults",children:"No missions found"})]})})]})}var sQ={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},sV=f.default.createContext&&f.default.createContext(sQ),sq=["attr","size","title"];function sX(){return(sX=Object.assign.bind()).apply(this,arguments)}function sW(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 sY(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sW(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)):sW(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function sz(e){return t=>f.default.createElement(sZ,sX({attr:sY({},e.attr)},t),function e(t){return t&&t.map((t,r)=>f.default.createElement(t.tag,sY({key:r},t.attr),e(t.child)))}(e.child))}function sZ(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,sq),s=i||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),f.default.createElement("svg",sX({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,n,o,{className:r,style:sY(sY({color:e.color||t.color},t.style),e.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),a&&f.default.createElement("title",null,a),e.children)};return void 0!==sV?f.default.createElement(sV.Consumer,null,e=>t(e)):t(sQ)}function s$(e){return sz({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 s0(e){return sz({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 s1({cameraRef:e}){let[t,r]=(0,f.useState)(!1),n=(0,f.useRef)(null),i=(0,f.useCallback)(async()=>{clearTimeout(n.current);let t=e.current;if(!t)return;let i=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}`}(t),a=`${window.location.pathname}${window.location.search}${i}`,o=`${window.location.origin}${a}`;window.history.replaceState(null,"",a);try{await navigator.clipboard.writeText(o),r(!0),n.current=setTimeout(()=>{r(!1)},1300)}catch(e){console.error(e)}},[e]);return(0,d.jsxs)("button",{type:"button",className:"IconButton CopyCoordinatesButton","aria-label":"Copy coordinates URL",title:"Copy coordinates URL",onClick:i,"data-copied":t?"true":"false",children:[(0,d.jsx)(s$,{className:"MapPin"}),(0,d.jsx)(s0,{className:"ClipboardCheck"})]})}function s9({missionName:e,missionType:t,onChangeMission:r,cameraRef:n}){let{fogEnabled:i,setFogEnabled:a,fov:o,setFov:s,audioEnabled:l,setAudioEnabled:u,animationEnabled:c,setAnimationEnabled:f}=(0,eS.useSettings)(),{speedMultiplier:h,setSpeedMultiplier:m}=(0,eS.useControls)(),{debugMode:p,setDebugMode:A}=(0,eS.useDebug)();return(0,d.jsxs)("div",{id:"controls",onKeyDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(sK,{value:e,missionType:t,onChange:r}),(0,d.jsx)(s1,{cameraRef:n}),(0,d.jsxs)("div",{className:"CheckboxField",children:[(0,d.jsx)("input",{id:"fogInput",type:"checkbox",checked:i,onChange:e=>{a(e.target.checked)}}),(0,d.jsx)("label",{htmlFor:"fogInput",children:"Fog?"})]}),(0,d.jsxs)("div",{className:"CheckboxField",children:[(0,d.jsx)("input",{id:"audioInput",type:"checkbox",checked:l,onChange:e=>{u(e.target.checked)}}),(0,d.jsx)("label",{htmlFor:"audioInput",children:"Audio?"})]}),(0,d.jsxs)("div",{className:"CheckboxField",children:[(0,d.jsx)("input",{id:"animationInput",type:"checkbox",checked:c,onChange:e=>{f(e.target.checked)}}),(0,d.jsx)("label",{htmlFor:"animationInput",children:"Animation?"})]}),(0,d.jsxs)("div",{className:"CheckboxField",children:[(0,d.jsx)("input",{id:"debugInput",type:"checkbox",checked:p,onChange:e=>{A(e.target.checked)}}),(0,d.jsx)("label",{htmlFor:"debugInput",children:"Debug?"})]}),(0,d.jsxs)("div",{className:"Field",children:[(0,d.jsx)("label",{htmlFor:"fovInput",children:"FOV"}),(0,d.jsx)("input",{id:"fovInput",type:"range",min:75,max:120,step:5,value:o,onChange:e=>s(parseInt(e.target.value))}),(0,d.jsx)("output",{htmlFor:"speedInput",children:o})]}),(0,d.jsxs)("div",{className:"Field",children:[(0,d.jsx)("label",{htmlFor:"speedInput",children:"Speed"}),(0,d.jsx)("input",{id:"speedInput",type:"range",min:.1,max:5,step:.05,value:h,onChange:e=>m(parseFloat(e.target.value))})]})]})}let s2=f.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,makeDefault:n,children:i,...a},o)=>{let s=(0,eB.useThree)(({set:e})=>e),l=(0,eB.useThree)(({camera:e})=>e),u=(0,eB.useThree)(({size:e})=>e),c=f.useRef(null);f.useImperativeHandle(o,()=>c.current,[]);let d=f.useRef(null),h=function(e,t,r){let n=(0,eB.useThree)(e=>e.size),i=(0,eB.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,h=f.useMemo(()=>{let e=new p.WebGLRenderTarget(a,o,{minFilter:p.LinearFilter,magFilter:p.LinearFilter,type:p.HalfFloatType,...c});return d&&(e.depthTexture=new p.DepthTexture(a,o,p.FloatType)),e.samples=l,e},[]);return f.useLayoutEffect(()=>{h.setSize(a,o),l&&(h.samples=l)},[l,h,a,o]),f.useEffect(()=>()=>h.dispose(),[]),h}(t);f.useLayoutEffect(()=>{a.manual||(c.current.aspect=u.width/u.height)},[u,a]),f.useLayoutEffect(()=>{c.current.updateProjectionMatrix()});let m=0,A=null,g="function"==typeof i;return(0,eC.useFrame)(t=>{g&&(r===1/0||m<r)&&(d.current.visible=!1,t.gl.setRenderTarget(h),A=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,c.current),t.scene.background=A,t.gl.setRenderTarget(null),d.current.visible=!0,m++)}),f.useLayoutEffect(()=>{if(n)return s(()=>({camera:c.current})),()=>s(()=>({camera:l}))},[c,n,s]),f.createElement(f.Fragment,null,f.createElement("perspectiveCamera",(0,eJ.default)({ref:c},a),!g&&i),f.createElement("group",{ref:d},g&&i(h.texture)))});function s3(){let{fov:e}=(0,eS.useSettings)();return(0,d.jsx)(s2,{makeDefault:!0,position:[0,256,0],fov:e})}var s8=e.i(51434),s5=e.i(81405);function s6(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}function s4({showPanel:e=0,className:t,parent:r}){let n=function(e,t=[],r){let[n,i]=f.useState();return f.useLayoutEffect(()=>{let t=e();return i(t),s6(void 0,t),()=>s6(void 0,null)},t),n}(()=>new s5.default,[]);return f.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,h.j)(()=>n.begin()),s=(0,h.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 s7=e.i(60099);function le(){let{debugMode:e}=(0,eS.useDebug)(),t=(0,f.useRef)(null);return(0,f.useEffect)(()=>{let e=t.current;e&&e.setColors("rgb(153, 255, 0)","rgb(0, 153, 255)","rgb(255, 153, 0)")}),e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s4,{className:"StatsPanel"}),(0,d.jsx)("axesHelper",{ref:t,args:[70],renderOrder:999,children:(0,d.jsx)("lineBasicMaterial",{depthTest:!1,depthWrite:!1,fog:!1,vertexColors:!0})}),(0,d.jsx)(s7.Html,{position:[80,0,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"y",children:"Y"})}),(0,d.jsx)(s7.Html,{position:[0,80,0],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"z",children:"Z"})}),(0,d.jsx)(s7.Html,{position:[0,0,80],center:!0,children:(0,d.jsx)("span",{className:"AxisLabel","data-axis":"x",children:"X"})})]}):null}var lt=e.i(50361),lr=e.i(24540);function ln(e,t,r){try{return e(t)}catch(e){return(0,lr.l)("[nuqs] Error while parsing value `%s`: %O"+(r?" (for key `%s`)":""),t,e,r),null}}function li(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),ln(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 la(e,t){return e.valueOf()===t.valueOf()}li({parse:e=>e,serialize:String}),li({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)}),li({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)}),li({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}}),li({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),li({parse:e=>"true"===e.toLowerCase(),serialize:String}),li({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:la}),li({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:la}),li({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:la});let lo=(0,lt.r)(),ls={};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,lt.i)(h)?null:ln(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 lu(e,t){return Object.fromEntries(Object.keys(e).map(r=>[r,e[r]??t[r]??null]))}let lc=new rU,ld={toneMapping:p.NoToneMapping,outputColorSpace:p.SRGBColorSpace},lf=li({parse(e){let[t,r]=e.split("~"),n=(0,rR.getMissionInfo)(t).missionTypes;return r&&n.includes(r)||(r=n[0]),{missionName:t,missionType:r}},serialize:({missionName:e,missionType:t})=>1===(0,rR.getMissionInfo)(e).missionTypes.length?e:`${e}~${t}`,eq:(e,t)=>e.missionName===t.missionName&&e.missionType===t.missionType}).withDefault({missionName:"RiverDance",missionType:"CTF"});function lh(){let[e,t]=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,f.useId)(),n=(0,lr.i)(),i=(0,lr.a)(),{history:a="replace",scroll:o=n?.scroll??!1,shallow:s=n?.shallow??!0,throttleMs:l=lt.s.timeMs,limitUrlUpdates:u=n?.limitUrlUpdates,clearOnDefault:c=n?.clearOnDefault??!0,startTransition:d,urlKeys:h=ls}=t,m=Object.keys(e).join(","),p=(0,f.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,h[e]??e])),[m,JSON.stringify(h)]),A=(0,lr.r)(Object.values(p)),g=A.searchParams,v=(0,f.useRef)({}),C=(0,f.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(",")]),B=lt.t.useQueuedQueries(Object.values(p)),[y,b]=(0,f.useState)(()=>ll(e,h,g??new URLSearchParams,B).state),x=(0,f.useRef)(y);if((0,lr.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,h,g,B,v.current,x.current);n&&((0,lr.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,f.useEffect)(()=>{let{state:t,hasChanged:n}=ll(e,h,g,B,v.current,x.current);n&&((0,lr.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,f.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,lr.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,lr.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,lr.c)("[nuq+ %s `%s`] Subscribing to sync for `%s`",r,e,m),lo.on(e,t[n])}return()=>{for(let n of Object.keys(e)){let e=p[n];(0,lr.c)("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",r,e,m),lo.off(e,t[n])}}},[m,p]);let E=(0,f.useCallback)((t,n={})=>{let f,h=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g="function"==typeof t?t(lu(x.current,C))??h:t??h;(0,lr.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);lo.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,lr.s)(422));let e=n?.limitUrlUpdates?.timeMs??u?.timeMs??h.limitUrlUpdates?.timeMs??lt.s.timeMs,t=lt.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(lt.t.abort(m)),lt.n.push(C,e),B=!0}}let b=y.reduce((e,t)=>t(e),B?lt.n.flush(A,i):lt.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,f.useMemo)(()=>lu(y,C),[y,C]),E]}({[e]:{parse:r??(e=>e),type:n,serialize:i,eq:a,defaultValue:o}},s);return[l,(0,f.useCallback)((t,r={})=>u(r=>({[e]:"function"==typeof t?t(r[e]):t}),r),[e,u])]}("mission",lf),r=(0,f.useCallback)(e=>{window.location.hash="",t(e)},[t]),{missionName:n,missionType:i}=e,[a,o]=(0,f.useState)(0),[s,l]=(0,f.useState)(!0),u=a<1;(0,f.useEffect)(()=>{if(u)l(!0);else{let e=setTimeout(()=>l(!1),500);return()=>clearTimeout(e)}},[u]),(0,f.useEffect)(()=>(window.setMissionName=e=>{let t=(0,rR.getMissionInfo)(e).missionTypes;r({missionName:e,missionType:t[0]})},window.getMissionList=rR.getMissionList,window.getMissionInfo=rR.getMissionInfo,()=>{delete window.setMissionName,delete window.getMissionList,delete window.getMissionInfo}),[r]);let c=(0,f.useCallback)((e,t=0)=>{o(t)},[]),h=(0,f.useRef)(null);return(0,d.jsx)(ed,{client:lc,children:(0,d.jsx)("main",{children:(0,d.jsxs)(eS.SettingsProvider,{children:[(0,d.jsxs)("div",{id:"canvasContainer",children:[s&&(0,d.jsxs)("div",{id:"loadingIndicator","data-complete":!u,children:[(0,d.jsx)("div",{className:"LoadingSpinner"}),(0,d.jsx)("div",{className:"LoadingProgress",children:(0,d.jsx)("div",{className:"LoadingProgress-bar",style:{width:`${100*a}%`}})}),(0,d.jsxs)("div",{className:"LoadingProgress-text",children:[Math.round(100*a),"%"]})]}),(0,d.jsx)(y,{frameloop:"always",gl:ld,shadows:{type:p.PCFShadowMap},onCreated:e=>{h.current=e.camera},children:(0,d.jsx)(rB,{children:(0,d.jsxs)(s8.AudioProvider,{children:[(0,d.jsx)(rG,{name:n,missionType:i,onLoadingChange:c},`${n}~${i}`),(0,d.jsx)(s3,{}),(0,d.jsx)(le,{}),(0,d.jsx)(r8,{})]})})})]}),(0,d.jsx)(s9,{missionName:n,missionType:i,onChangeMission:r,cameraRef:h})]})})})}function lm(){return(0,d.jsx)(f.Suspense,{children:(0,d.jsx)(lh,{})})}e.s(["default",()=>lm],31713)}]); |